Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can i have one array per instance of a class
Message
 
 
To
09/05/2001 00:14:58
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00505126
Message ID:
00505131
Views:
24
>I don't really understand variable/array scoping too well and need some help.
>
>I built a container class. The class has a combobox in it. (Actually 2 comboboxes). Then I inserted an instance of the class into each column of a 5 column grid. So now my grid has the container object instead of the default text, in each column.
>
>Now I want to use recordsource type of 5 - array, for the combobox. But this combobox gets instantiated about 30 times, once for each row/column in the grid. How can I get a unique array for each instance?
>
>Is it possible to have an array or array elements as properties of the form, or of the class? Is something like: thisform.grid1.column1.container.combobox.array[1].value='abcd' possible, or legal?

Yes, it's legal, ecxept that you have to use real name of the container (I assume, Container1 and legal name of the array property, say, myArray). Now, assuming you want to assign the first element of all columns first combo array, you may try this:
local loColumn
for each loColumn in this.Columns && This is a grid
         store "fff" to loColumn.Container1.Combo1.myArray[1] && if you would not specify the array index, you'll store  "fff" to all elements of the array
next
>
>In the past I have only made form properties as simple variables. If it is possible to make a property as an array, how would u declare it?
>
>Thanks.

Yes, it's possible in both design time (using Form/New Property menu) or in run-time using AddProperty method.

In the class you can use
dimension this.MyArray[5,2] any time you want to redimension this array.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform