Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Iterating through form's controls
Message
 
 
To
23/08/2000 12:25:47
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00407951
Message ID:
00408321
Views:
38
Mike,

First of all I'd like to thank you for the code, you're provided. It's very usefull.
Secondly, I'm going to implement Tray's idea, which seems to be the most efficient. (Actually, I've already implemented it, currently I'm in deep of modifying code, which remindes me, that I forgot to make a backup first :).

Let me give you a little bit more explanation of the project, I'm working, in order for all of you to undertsand my goals.

I have an application, which basically allows our users to make their selection criteria. This application returns where expression as a string and join and from condition through variables. It doesn't execute SQL, which is responsibility of another 'upper' application. It has quite complicated logic to save and restore configurations via meta-file (e.g. when user specifies his/her criteria, it's considered as a new configuration and this configuration should be saved and restored the next time). Currently each criterion saves and restores its state. All of the sudden I realized, that it's not efficient. If the form uses only small fraction of available criteria, there is no need to save and restore them, since they are already in default state. Now I'm going to implement this 'revolutionary' (:)) idea in live.

So, basically, I should have a mechanism to put each selection criterion to its default state. I should also be able to determine, does or does not a particular criterion need to be saved.


>>I'd like to write a Form method SetDefaultState with would set each control (criterion) to its default state. Now my question is: what would be better from optimization point of view: use this construction:
>
>If you don't use it yet, you can speed up the createion of your Pageframes, but using blank pages until the page is activated, then add a container class that contains what would normally be your page at runtime.
>
>What exactly you do you mean by "Default State"? If you want it to be as fast as possible, are these settings that could be set in the form designer in the first place?
>
>IAC, Here's some code to loop through all the controls on a form, off my head anyways, so you'll want to tweak it:
>
>
*Form.LoopThrouhgControls()
>lparameters loObject
>local loControl, lcBaseClasses
>lcBaseClasses = 'FORM GRID COLUMN CONTAINER CONTROL COMMANDGROUP OPTIONGROUP PAGE PAGEFRAME'
>
>do case
>	case type('loObject.ControlCount') = 'N'
>		for each loControl in loObject.Controls
>			loControl.Setup()
>			if upper(loControl.BaseClass) $ lcBaseClasses
>				thisform.LoopTHroughControls(loControl)
>			endif
>		endfor
>
>	case type('loObject.ButtonCount') = 'N'
>		for each loControl in loObject.Buttons
>			loControl.Setup()
>			if upper(loControl.BaseClass) $ lcBaseClasses
>				thisform.LoopTHroughControls(loControl)
>			endif
>		endfor
>
>	case type('loObject.PageCount') = 'N'
>		for each loControl in loObject.Pages
>			loControl.Setup()
>			if upper(loControl.BaseClass) $ lcBaseClasses
>				thisform.LoopTHroughControls(loControl)
>			endif
>		endfor
>
>	case type('loObject.ColumnCount') = 'N'
>		for each loControl in loObject.Columns
>			loControl.Setup()
>			if upper(loControl.BaseClass) $ lcBaseClasses
>				thisform.LoopTHroughControls(loControl)
>			endif
>		endfor
>endcase
>Which reminds me of a wish, all container objects should have Controls and ControlCount, not Pages and Pagecount, ect.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform