Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cycling through controls in a form
Message
De
07/06/2002 13:06:12
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00666032
Message ID:
00666051
Vues:
25
This message has been marked as a message which has helped to the initial question of the thread.
>Hi all, can anybody tell me how can I cicle through all the controls in a form and catch an specific property's value?
>
>For example if I got 3 buttons in a form and wanna know the status of the enable property for each button. How can I do this? I've tried using the controls and controlscount properties but had not good results, think I'm missing something here.
>
>TIA
>
>Enmanuel

Controls or controlscount is not sufficient for there might be controls like pageframe, grid etc which also has pages, columns, column.controls etc.
You'd need to recursively walk into each container.
Instead of Controls collection try amembers(). Here is partial code from FoxyClasses - UDFObjCollector class.
*WalkCollection
Lparameters oContainerObject
local oObject, nMembers
local array aContainerObjects[1]
nMembers = amembers(aContainerObjects, oContainerObject,2)
With this
 For ix = 1 to nMembers   && Start collecting
  oObject = eval("oContainerObject."+aContainerObjects[ix])
* Do something with object
  .WalkCollection(oObject)  && Recurse
  oObject=.null.
Endfor
Endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform