Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help - In need of accessing all objects in FORM
Message
 
To
22/07/2003 16:41:14
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00812542
Message ID:
00812581
Views:
16
Try using a recursive call to the same method passing the object that you need to recurse through.
*  Example call
THIS.RecurseObjects(THISFORM)

PROCEDURE RecurseObjects
LPARAMETERS loParentObject AS Object

FOR EACH loObj IN loParentObject.Objects
   DO CASE
   CASE loObject.BaseClass = 'Pageframe'
      *   Need to manually handle each page of the page frame
      FOR EACH loPage IN loObj.Pages
          THIS.RecurseObjects(loPage)
      ENDFOR loPage
   CASE loObj.BaseClass = 'Container'
      *   Recurse through any container objects
      THIS.RecurseObjects(loObj)
   CASE PEMSTATUS(loObj,'ControlSource',5)
      this.DoMyCode(loObj)
   ENDIF
ENDFOR loObj
I haven't tested the above code and I don't do any error checking but this should give you a general idea of using a recursive call.

Kurt
>Help,
>
>I'm currently writing a program in VFP8 where I need to iterate thru all objects in a form in order to read/track objects (i.e.: controlsource).
>
>While reading Collection objects using the 'FOR EACH' loop command is fairly simple, it does get a bit tougher when your form has lots of container,pageframes/pages,grids etc...
>
>Does anyone out there have code solution for a clean/quick way for reading every object (i.e.: collections) in a form.
>
>
>*------------------------------------
>*- Current code
>*------------------------------------
>FOR EACH loObj IN thisform.Objects
> IF PEMSTATUS(loObj,'ControlSource',5)
> this.DoMyCode(loObj)
> ENDIF
>ENDFOR loObj
>
>*- How can I make code above read every object in form whether object is
>*- in a container,pageframe/page or grid.
>
>Thanks!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform