Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding an array objects to a form at runtime
Message
 
 
To
21/06/2000 07:11:09
Geert Van Snik
Zorgned Automatisering Bv
Wageningen, Netherlands
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00382600
Message ID:
00382758
Views:
14
Geert,

You must just use AddObject() to put the item directly into the form, not go through the oProductkop array:
for i = 1 to 10
   lcName = "txt" + padl( i, 3, '0' )
   thisform.AddObject( lcName, "productkop" )
   loProductkop = eval( "thisform." + lcName )
   with loProductkop
      .Top = ...
      .Visible = .t.
   endwith
endfor
>Hi there,
>
>In my cuurent project, I want to add a series of identical objects (home-built class) to a form at runtime. The number of objects to be added depends on the size of the screen, which can be modified by the user. I tried the following code:
>
>Thisform.Addproperty('oProductkop(20)', 1)
>FOR lcTeller = 1 to thisform.aant_kolom
> *!* Thisform.Addobject("oProductkop(lcteller)", "productkop")
>*!* This.addobject("oProductkop(" + str(lcteller) + ")", "productkop")
> Thisform.oProductkop(lcteller)= newobject("productkop","Std_veld.vcx")
> WITH Thisform.oProductkop(lcTeller)
> .top =Thisform.Grid1.top - 90
> .left = Thisform.Grid1.left +(lcteller*60)
> .visible = .T.
> .tabindex = 100 + lcteller
> ENDWITH
>NEXT
>
>where productkop is the name of the class, lcteller is a counter. The WITH-ENDWITH sets several properies in the oProductkop(lcteller) objects.the :Thisform.addproperty" adds the array to the form.
>
>All works fine; the objects are added to the form, the properties are set correctly, but the objects are NOT VISIBLE on the screen and therefore useless.
>What am I doing wrong? Is there another, correct, way to add an array of identical objects to a screen at runtime?
>
>With kind regards,
>
>Geert van Snik
>Zorgned Automatisering.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform