Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add existing object to form
Message
From
04/06/2003 03:39:14
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00795977
Message ID:
00796019
Views:
14
Thanks David,
I feared as much. Thanks for the replication idea, I can use that in places.
I worked around my existing problem by splitting the object into two component objects. The visible bit and the existing bit and linked them with an ID. Essentially I wanted an image associated with the object but only to display a subset of all the objects (there are thousands!) on the form at any one time.

So now I do roughly...
x= createobject('mythingy')
x.id= 'abc'  && a unique id

* later I can
thisform.addobject('img' + x.id, 'myimageclass')
* or
thisform.removeobject('img' + x.id)
Seems to work well.



>David,
>
>Nope, an already existing object can not be added to some other object. Also an object must be in the containership of a form (AddObject'd to the form) for it to be visible and participate in the UI event loop.
>
>You can "replicate" the object with code like:
>
>
thisform.AddObject( "oimage", x.Class )
>n = amembers( laPEMs, ox, 0 )
>
>for i = 1 to n
>   if ( ! pemstatus( thisform.oImage, laPEMs[i], 1 ) and laPEMs[i] != "NAME" )
>      store eval( "ox." + laPEMs[i]) to ("thisform.oImage." + laPEMs[i])
>   endif
>endfor
>
>>AddObject() creates and adds an object to a form.
>>Is there a way to add an existing object instance to a form
>>
>>eg
>>x= createobject('image')
>>do form myform
>>
>>where myform has a command button...
>>*** myform.command1.click() ***
>>thisform.addxobject('image1', x)
>>thisform.image1.visible= .t.
Previous
Reply
Map
View

Click here to load this message in the networking platform