Jump to content
Gary Mugford

Slight Refinement to Component Property Replace

Recommended Posts

First of all, kudos to all the folks who participate in making GExperts. It is all appreciated. And in this particular case, I guess Robert Wachtel gets a big share. Thanks.

 

Now, I THINK the reason for the expert is that people get busy working on a form and at some point, the compiled application won't do something particular, like say emptying a table, because it's still active in the IDE. I'm running head on into that nightmare right now.

 

The Component Property Replace expert would save my mental fugues if it was JUST a little more particular about what it chooses to switch and what it doesn't. I have a BIG project, and it's an OLD project done in D7. There are a couple of data modules, one BIG central calling form and a nightmarish number of sub-forms. All of this grew organically and is out of control. A replacement is underway, but it's nowhere near usable yet. So, I'm stuck updating the old app.

 

I'm working on a form that centres around a central database ON THE SUB-FORM that a number of reports run off of. I change things in any of the form's report objects and it auto-starts the database in question which I later need to deactivate before compiling. Something I do about HALF the time. Getting old and stupid. I would very much like this expert to replace my brain and do what I forget ... set the database.active to false JUST ON THIS FORM before compiling. Which the expert will be happy to do. But it also will reset the data modules and the big form, the latter one I expected from the fact it is open in the IDE, the former two, the data modules, somewhat surprisingly.

 

There is a setting that allows you to limit the resetting to just the forms open in the editor. I sort of have to have the main form up all the time. I COULD try going without it just for this focused (or lack of focused) programming frenzy with the sub-form in question, but it would cause other issues. So, I make the following suggestion: Please have the expert ONLY apply to the SINGLE ACTIVE File TAB in the IDE's editor. Alternatively, the open files in the editor (which should exclude the data modules in MY working example because they don't have an actual tab in the editor). That would let me make the decision to temporarily shut down the main form to concentrate on the sub-form. The best of all worlds would be a radio box that allows:

 

All files in project

All open files in editor

Just open file TAB in the editor

 

Maybe reverse the three based on left-side/Top-side DEFAULT bias for picking since it's the small end of the working group numbers.

 

Lastly, and this is probably the fly in my ointment ... I use Castalia as my editor. That MIGHT be why the data modules get included in my run of the expert. Or would, if I turned it loose to actually protect me against the ONE thing, while causing me to go back and but in the code to turn on databases on Form Creation for all the affected switch offs. A daunting task and why I am not actually USING the expert currently.

 

Second lastly, a different approach, which I think is impossible ... letting me cite Form and component as a direct target. I'm actually doing this for ONE annoyance currently. Say I could put in TWorkingForm.TTable and have THAT set to false on compile FIXES ALL MY PROBLEMS and it doesn't create the possibility of mistakes spreading if I pick the wrong choice in my hypothetical radio box above.

 

Regardless of whether this spurs anybody into their own programming frenzy, just want to repeat how much appreciation GExpers has from me. Thanks.

Share this post


Link to post

Wouldn't opening the database and tables in the data module's constructor solve this problem? I've never been a fan of leaving anything active in the designer.

 

I must admit that I currently have no idea how this particular expert works. And I'm currently too busy with other stuff to invest much time in it.

 

If you think it's worth the effort, please file a feature request on SourceForge for it. A few screen shots would go a long way to make a bit clearer what you mean. Or even better: An example project, which could then also be used to test the changes, if I or anybody else ever comes around doing it.

Edited by dummzeuch

Share this post


Link to post

Dummzeuch,

 

Thanks for getting back to me. The reproducible answer would be, by necessity, a small project and the answer would inevitably be, have all database connections start with being off (perhaps through the expert in question) and then start them at run-time according to need. That way, when working with ReportBuilder on a single form at any given moment, you can ignore the fact that RB ACTIVATES the datasource while working on it within the IDE. IF you forget to deactivate the datasource before compiling, then come runtime testing, it will hit for example, table.emptytable, the program will throw and error, citing that the table is busy, Again, if you are starting over and (in good programming form) starting up the databases at run time in the code, this is the obvious situation the expert is for. 

 

MY Problem is that this is a 30 year old program that wasn't designed all that well at the beginning and only got worse as kludges and new features were added willy-nilly. I have, over hundreds of forms, and the two datamodules, several hundreds of database connections (I think a shade more than 400 at last count). Some are inactive. MOST aren't. They come up ready to go without me writing any lines of code. The expert DOES say it will only affect the active files in the editor, which in my case includes the BIG central form, with around 80 active databases on it .... yes, I can read the comments to be written already and acknowledge, in advance, their correctness ... as well as two data modules with about 200 connections, mostly active in the dLookUp module and mostly in active in the dData module. The expert, despite neither datamodule being in the editor at the time, indicated it would reset all connections in them, as well as the big central form and the one form I was working on. I needed it to be on the form I was working on ONLY. 

 

I think my narrow niche need for work on this is beyond making a request official. It's not worth other programmer's valuable time. Sigh. I was hoping the change would be a minor effort. Since it's not your expert, I understand what I am asking for. So, I will have to change things around just a little bit. I've lowered the top edge of the IDE and overtop of the button that I click to compile, I have placed a graphic telling me to DEACTIVATE the CBOX.DB. Crude, but it seems to be working.

 

Again, thanks for all you do for the community. GM

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×