Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Collections and Objects / controls
Message
From
28/10/2004 18:36:12
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Collections and Objects / controls
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Miscellaneous
Thread ID:
00955594
Message ID:
00955594
Views:
54
I'm trying to find all objects and all objects / controls within other objects (container type controls like Pages on pageframes and Headers in Grids) on a given form, provided they have a Caption property.

If I find one, and the Caption <> "", I'd like to write the full hierachy to a file. That's the part I know how to do.

So far I've come up with the following, which gives me part of what I want, but for some reason skips the grids.

As usual I'm probably not thinking straight, so all help is appreciated.
FOR EACH oObject IN THISFORM.OBJECTS
   IF PEMSTATUS(oObject,"Caption",5)
      cCaption    = ""
      cLevel1Name = THISFORM.NAME + "." + oObject.NAME + ".Caption "
      cCaption    = oObject.CAPTION
      IF cCaption # ""
         oApplicationInit.WriteIniFile(lcIniFile, lcSection, cLevel1Name, cCaption)
      ENDIF
   ENDIF

   IF PEMSTATUS(oObject,"Objects",5)  && If it itself contains objects 
      FOR EACH oObject2 IN oObject.OBJECTS
         cCaption= ""
         IF PEMSTATUS(oObject2,"Caption",5)
            cLevel2Name = THISFORM.NAME + "." + oObject.NAME + "." + oObject2.NAME + ".Caption "
            cCaption= oObject2.CAPTION
            IF cCaption # ""
               oApplicationInit.WriteIniFile(lcIniFile, lcSection, cLevel2Name, cCaption)
            ENDIF
         ENDIF
      ENDFOR

      IF PEMSTATUS(oObject2,"Objects",5)
         FOR EACH oObject3 IN oObject2.OBJECTS
            cCaption= ""
            IF PEMSTATUS(oObject3,"Caption",5)
               cLevel3Name = THISFORM.NAME + "." + oObject.NAME + "." + oObject2.NAME + "." + oObject3.NAME + ".Caption "
               cCaption= oObject3.CAPTION
               IF cCaption # ""
                  oApplicationInit.WriteIniFile(lcIniFile, lcSection, cLevel3Name, cCaption)
               ENDIF
            ENDIF
         ENDFOR
      ENDIF
   ENDIF
ENDFOR
Peter Pirker


Whosoever shall not fall by the sword or by famine, shall fall by pestilence, so why bother shaving?

(Woody Allen)
Next
Reply
Map
View

Click here to load this message in the networking platform