Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Recurse through all controls
Message
From
19/05/2004 05:47:08
 
 
To
18/05/2004 07:28:14
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00904798
Message ID:
00905189
Views:
15
>>Has anyone got a good tight routine that recurses through all controls on a form, including containers, pageframes etc. ?
>>
>>I keep coming up with code that looks too ugly to be doing it smart ! :)
>
>If you're in VFP 7 or later, you can use the Objects property. This is untested, but should give you the idea:
>
>
>FUNCTION Process
>LPARAMETERS oControl
>
>* Do whatever to oControl
>
>IF PEMSTATUS(oControl, "Objects", 5)
>   FOR EACH oObject IN oControl.Objects
>      This.Process(oObject)
>   ENDFOR
>ENDIF
>
>
>Oh, and the verb you're looking for is "recur," not "recurse."
>
>Tamar


Hi Tamar,

Things are getting easier by the day :)
This one was written 5-6 years ago.

As for your code, I just would'n implement it as function
for practicality reasons ;
FUNCTION Process
LPARAMETERS oControl

* Do whatever to oControl

* This means that you have to write 
* one function for each use.

IF PEMSTATUS(oControl, "Objects", 5)
   FOR EACH oObject IN oControl.Objects
     This.Process(oObject) 
   ENDFOR
ENDIF
I would prefer this to be part of some class / object,
having one method 'free' to play with controls as I am pleased :)

Best Regards
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform