Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Iterate through all objects on form
Message
From
31/12/2008 11:24:53
 
 
To
31/12/2008 09:44:26
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01370241
Message ID:
01370337
Views:
20
I'm almost there, but just need a little guidance. I know there is something wrong with putting that code in the OTHERWISE, but I can't think what else to do. I need to run for every control on the form in addition to those inside containers. But, I do not want to run my binding code if it is a form, as this code is on the form and it doesn't like trying to bind to itself. I'm getting caught in an endless loop where toObject is .F. when it gets recalled in the OTHERWISE. What am I doing wrong here?

Call the method and pass it Thisform

Modified code below:
LPARAMETERS toObject

LOCAL loControl, loPage, lnButton

WITH toObject

	IF UPPER( .BASECLASS ) <> 'FORM'
		IF PEMSTATUS( toObject, 'RightClick', 5 )
			BINDEVENT(THISFORM,"RightClick",toObject,"RightClick")
		ENDIF
	ENDIF

	DO CASE

		CASE UPPER( .BASECLASS ) = 'PAGEFRAME'
			FOR EACH loPage IN .PAGES
				THIS.ThisMethodCall( loPage )
			ENDFOR

		CASE INLIST( UPPER( .BASECLASS ), 'PAGE', 'CONTAINER', 'FORM' )
			FOR EACH loControl IN .CONTROLS
				THIS.ThisMethodCall( loControl )
			ENDFOR

		CASE INLIST( UPPER( .BASECLASS ), 'COMMANDGROUP', 'OPTIONGROUP' )
			LOCAL lnButton
			FOR lnButton = 1 TO .BUTTONCOUNT
				THIS.ThisMethodCall( .BUTTONS[ lnButton ] )
			ENDFOR

	ENDCASE

ENDWITH
Previous
Reply
Map
View

Click here to load this message in the networking platform