Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Controls collection at design time
Message
De
21/01/2004 19:43:01
 
 
À
21/01/2004 17:29:25
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00869260
Message ID:
00869321
Vues:
15
>I'm writing a builder which replaces controls. It finds objects of certain class, adds a different object of the new class, copies properties from the old one, RemoveObject()s the old one.
>The trouble is how to do this in a loop. If I try going for i=1 to oParent.ControlCount, as soon as I remove the old one, the whole collection is reshuffled. I'll probably fix it by doing for i=oParent.controlcount to 1 step -1, so those I replaced will be removed from the current position and new ones added in the end, which would be just OK (except the instantiation order would now be reverse - but this should not be important, or there's something wrong with the design).
>
>The trouble I have is when I attempt to do For Each oMember of loObj.Controls - it gives me syntax error for a form with just two objects (a pageframe and a custom). The collection is visible in debugger while the builder runs, and also in the command window - any member of the collection can be accessed by number. It's just that For Each it gives a syntax error.
>
>VFP7 SP1. Can anyone check whether this works in VFP8?
>
>
* have a form with a few controls open for editing
>aselobj(oForms,1)
>oForm=oForms[1]
>for each oControl of oForm.controls
>   ? oControl.name
>endfor
>Save this in a prg and run it while editing a form, I need to know whether anything changed here in VFP8.

Hi Dragan,

I wrote a tool for this purpose which is available in the downloads as NewClass. Check it out.

Glenn
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform