This example might help.
lo = Createobject('cCustom')
With lo
? .ControlCount
**
** Adding a FoxPro Base class. Added as a Control
**
.AddObject('cmdButton1','CommandButton')
? .ControlCount
**
** Object added thru addObject. Becomes a control
**
.AddObject('oObject2','cObject2')
?.ControlCount
Endwith
Define Class cCustom As Custom
**
** Object reference added as a property defined
** in the class.
**
oObject1 = .Null.
Function Init()
oObject1 = Createobject('cObject1')
EndFunc
Enddefine
Define Class cObject1 As Custom
Enddefine
Define Class cObject2 As Custom
Enddefine
The diference being that if you create it as a property, VFP doesn't see it as a control. Just a property. If you add it on the fly it becomes a control.
Hope this helps
>Yea, you're right, I have no problem accesing the objects the way you're saying but my problem is that I need to make a loop through them. Someting like:
>
>With oApp.Modules.ControlCount
> do something
>endwith
>
>The property ControlCount is 0 in oApp (the master object), even when there are 5 objects (CUSTOM class) attached. Why?
>
>Any idea?