[Gambas-user] gb3: public array that is dimensioned later

Kevin Fishburne kevinfishburne at ...1887...
Thu Aug 4 02:57:20 CEST 2011


On 08/03/2011 08:09 PM, Benoît Minisini wrote:
>> On 08/03/2011 07:00 PM, Kevin Fishburne wrote:
>>> I need to create a public array in a module but specify its dimensions
>>> in a procedure later. Is this possible, and how would it be done
>> I forgot to mention, I'd like it to be a 2D array, though I could write
>> workaround code if it has to be 1D.
> You have to specify the array dimensions at the same time you create it. So
> you have to create it in your later procedure.

Hmmm. It's been my experience that public variables have to be declared 
at the top of a module outside of the procedures and that Dim needs to 
be used inside procedures. Is there some way around this? The variables 
which determine the number of dimensions of the array are calculated 
from values input by the user, but need to be persistent and accessible 
from multiple separate procedures. If it's not possible I'll make it 1D 
and use code so that it can be treated as 2D, dimensioning it to 
"maximum realistic size" when it's created.

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list