>Using VFP 3.0b on WinNT 4.0 ws w/ sp3.
>
>I want to have a command button which visits each object on the form and depending on some criteria (such as baseclass, perhaps) does something. I thought at first that I could use ActiveControl and ControlCount and do something like this:
>
>for myCount = 1 to ControlCount step 1
> thisform.ActiveControl = myCount
> * do something, like assign value to control or
> * get value from control or something else...
>endfor
>
>Unfortunately, this doesn't work because ActiveControl is read-only at runtime. Is there a way that I can accomplish??
>
>Regards,
>
>Marc Mandel
Marc,
I develop in VFP 5 so this may not work in VFP 3.0 b.
Container type objects have an array - 'Controls()' which can be accessed like this:
LOCAL loObject, liIdx
loObject = thisform
FOR liIdx = 1 to loObject.ControlCount STEP 1
loObject.Controls(liIdx).myMethod()
loObject.Controls(liIdx).myProperty = SomeValue
ENDFOR
Of course 'myMethod' and 'myProperty' must be defined in the control being accessed. You can use PEMSTATUS() to check for the existence of the method/property (not sure though if this function is available in 3.0 b??).
Also, you may need to drill down into any container objects that are members of the container currently being processed. If you have a pageframe that needs to be processed, use the 'pages()' array in a similar fashion.
Hope this helps.