Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Iterating through form's controls
Message
From
23/08/2000 12:25:47
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00407951
Message ID:
00408311
Views:
40
This message has been marked as a message which has helped to the initial question of the thread.
>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()
			upper(if 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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform