Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Storing Object References
Message
 
 
À
26/09/1996 18:35:29
Paul Watson
Mcv Global Systems, Inc.
Pasadena, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00008632
Message ID:
00008643
Vues:
33
>I was planning on creating the array as a form property. I guess I was a little unclear in my explanation. The text box objects already exist on the form. I want to store references to them in the array so that I can easily get back to them later. I really want to say "aArray[nPtr] = THIS". I know I can't do that though. Then later I could say aArray[nPtr]. = .

Believe it or not, this works great for me.

1. Create an array as a form property.
2. Using ThisForm, or a reference thereto, simply use: ThisForm.Addobject(cFormArrayElemName,cClassName)

To build the object name:

Assume your form property array is called aTxtBoxes, and that you are loopwise instantiating textbox objects and assigning a reference for each textbox to the nth element of the property array:

* Build the character string that holds the literal expression for the array element:
cNewTxtBoxElem="aTxtBoxes("+allt(str(n))+")"
* Instantiate the textbox
ThisForm.AddObject(cNewTxtBoxElem,"TextBox")

And there's your control array. I find it easier to subclass the textbox, even if I change nothing from the base class, so that I can slam the subclass with SetAlls and not effect other textboxes on my form.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform