Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AddObject/RemoveObject
Message
From
28/03/2002 08:14:44
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00635975
Message ID:
00638338
Views:
24
>Hilmar,
>
>First off, I guess I'd say that I'd never really use any of those options that you present in the article.
>
>This statement:
>
>Explanation: 1) Apparently, with RemoveObject() you can only eliminate the first object in the creation order. 2) ZOrder(1) ("send to back") changes this "creation order". ThisForm.RemoveObject("aOptions(5)") doesn't remove anything.
>
>Is most definately false. RemoveObject() can remove any contained object at any time, ZOrder() also has nothing to do with it. I think the only reason you are having a problem is caused by this "peculiar" method you are proposing of creating dynamic forms.

Thanks. I will review the corresponding text.

Also, I copied your sample code (below), as a fourth alternative.

>
for i = 1 to lnRows
>   for j = 1 to lnCols
>      lcName = "cnt" + padl( i, 2, '0' ) + padl( j, 2, '0' )
>      this.AddObject( lcName, "cntGroup" )
>      loObject = eval( "this." + lcName )
>      with loObject
>         .Top = ( i - 1 ) * .Height + 5
>         .Left = ( j - 1 ) * .Width + 5
>         ...
>         .Visible = .t.
>      endwith
>   endfor
>endfor
>
>To iterate these controls I simply use the Objects[] collection:
>
>
for each loObject in this.Objects
>   if ( loObject.Class = "cntGroup" )
>      ...
>   endif
>endfor
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