>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement