Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generic code to find object in form
Message
From
01/09/2008 14:34:35
 
 
To
01/09/2008 13:44:09
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01343851
Message ID:
01343871
Views:
19
>Hi,
>
>
>I am 'fighting' with the code to construct a generic search method to find for and get the value of a given property on a form.
>
>The Object's Hierarchy can be in a container or in a Page or even in a Page on a Page e.s.o.
>Once the value of that Property is given, the form should act upon this value.
>Now either I shall have to for/next through all my objects on the form - this could than eventualy turn into a very slowing thing since you can expect 200+ objects on the form. Alternatively I could do the for/next loop only once, at init, load the value into a array and just query that array, making the loop remarkably smaller and thus quicker. Obviously this array should be updated on the moment the property's value is changed but that is easy enough handled with an extra property on the object.
>Now be4 reinventing the wheel. Do we have knowledge of any such class?
>Regards,
>Koen

I'm not sure what you are trying to do, but if you were looking for the value of a property or object named "myobject" you could do:
loForm = THISFORM
FOR EACH oObject IN loForm.Objects
	IF ALLTRIM(UPPER(oObject.BASECLASS))="PAGEFRAME" && step through the pageframe
		FOR EACH loPage IN oObject.PAGES
			FOR EACH oControl IN loPage.CONTROLS
				IF LOWER(oControl.Name) = "myobject"
					Wait WINDOW "Value is: "+oControl.Value
				ENDIF
			ENDFOR
		ENDFOR
	ELSE
		IF lower(oObject.Name) = "myobject"
			wait WINDOW "Value is: = " + oObject
		ENDIF
	ENDIF
ENDFOR
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform