How to create Global arrays
The first thing to do is to create a group in
the variables viewer.
You do this by clicking on the 'Add
Group' icon (the first icon).
This lets you name the group. A group is a collection
of variables
with something in common. You can call it anything
you like, as
long as it isn't the name of a window. I'll suppose
for the rest of
the article that you've called the group Global.
There is nothing
special about the name Global;
you can call it Fred
if you prefer.
It is however best to give the group a name which
reflects its function.
Once you have created your group, you can create
a variable. Click
on the 'Add variable'
icon (the second one) and select which group
you want to use. You can then type in the name
of the variable. If
you want an array, you type something like A$().
The variable name
must be unique within the group, but can be the
same as a variable in
another group.
You can now refer to the variable in your program.
Since the variable is
called A$()
and is in the group Global,
you refer to it as Global:A$()
So you might have Dim
Global:A$(30)
for example. All variables in
groups can be referred to from any procedure
or function, unlike local
variables. See the tutorial file 'Framework1'
for an example. As you can
see, the syntax for using group variables is
the same as that used for referring
to windows. In fact, windows are just a special
case of a group.
This means you can add your own variables to
window groups, just as you
can with groups you create yourself. The only
difference is that variables in
window groups only exist when the window is open.