Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AddObject/RemoveObject
Message
From
26/03/2002 07:26:24
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
26/03/2002 05:41:07
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00635975
Message ID:
00637160
Views:
18
>>Len, the following sample code will first create 10 objects on the form, and then delete object #5. It so happens that changing the ZOrder is equivalent to changing the "creation order"!
>>
>>
>>ThisForm.AddProperty("aOptions(10)")
>>for i = 1 to 10
>>	ThisForm.AddObject("aOptions(i)", "CheckBox")
>>	ThisForm.aOptions(i).Top = i * 20
>>	ThisForm.aOptions(i).Left = 100
>>	ThisForm.aOptions(i).Caption = "Option " + trans(i)
>>	ThisForm.aOptions(i).Visible = .T.
>>next
>>ThisForm.aOptions(5).ZOrder(1)
>>ThisForm.RemoveObject("aOptions")
>>
>
>Thanks for the update, don't forget to add it to the FAQ, it makes the array solution workable again (at least for me).

Yes, I will update it immediately. I am curious to know which method you decide to use in the end, and why. The alternative I proposed originally in the FAQ (now labelled "Option 1") has the advantage (I believe) of simplicity, and the disadvantage (as Sergey pointed out) of being undocumented. This means, it might no longer work in future releases of VFP.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform