Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Iterate through all objects on form
Message
From
30/12/2008 20:23:01
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01370241
Message ID:
01370278
Views:
32
I think I almost understand, but what I'm doing is using BindEvents to bind every possible control on a form, in containers, pageframes, etc, no matter what kind they are, as long as they have a RightClick method. Seems that there would be a way to just cycle through, and keep going deeper if needed, and be able to touch every control on the form, regardless of the type. It seems to me that this code could be very simple if it ignores the type of control and just treats them all the same if they have a RightClick method. I have something like this, but it doesn't seem to quite work. I'm sure my logic is off - very tired today - but I'm really trying to get this done tonight. Any help appreciated.

It starts with a call in the SHOW of a form like this:
THISFORM.ThisMethodCall( THISFORM )
And this is ThisMethodCall():
LPARAMETERS m.Container

WITH m.Container
	FOR EACH oControl IN .CONTROLS
		IF PEMSTATUS(.CONTROLS[oControl],'RightClick',5)
			BINDEVENT(THISFORM,"RightClick",.CONTROLS[oControl],"RightClick")
		ENDIF
	ENDFOR
	IF PEMSTATUS( oControl, 'Controls', 5 )
		ThisMethodCall( oControl )
	ENDIF
ENDWITH
>Jay,
>
>Just a quick and dirty solution might look like this
>
>
>* Method thisform.ShowControls
>lparameters toControl
>local loControl, loPage, loColumn
>do case
>	case Pemstatus(toControl, 'Controls', 5)
>		for each loControl in toControl.Controls
>			? 'Control:', loControl.Name
>			thisform.ShowControls(loControl)
>		endfor
>	case Pemstatus(toControl, 'Columns', 5)
>		for each loColumn in toControl.Columns
>			? 'Column:', loColumn.Name
>			thisform.ShowControls(loColumn)
>		endfor
>	case Pemstatus(toControl, 'Pages', 5)
>		for each loPage in toControl.Pages
>			? 'Page:', loPage.Name
>			thisform.ShowControls(loPage)
>		endfor
>endcase
>? 'Object:', toControl.Name
>
>
>[Update] Forgot to add the object
Previous
Reply
Map
View

Click here to load this message in the networking platform