Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Collections and Objects / controls
Message
De
28/10/2004 18:36:12
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Collections and Objects / controls
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Divers
Thread ID:
00955594
Message ID:
00955594
Vues:
55
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)
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform