Contents | Index | < Browse | Browse >
VARPATH VariableSearchPath
This command allows you to "Merge" the variables of many guis.
First of all, read the section on Normal Variables to understand it.
Now.. If you're making an application which will have many guis,
you may want to "Merge" their variables, so you don't have to state
the GUI part of the name each time, or remember in which of your
guis a certain variable was declared:
> VarPath "gui1/gui2"
will search your gui's variables (always done first) and if not
found will continue and search the vars of gui1 then gui2
So if you declare :
MyVar = 5
- Gui4Cli will search your gui for variable MyVar.
- If not found, it will search gui1, then gui2.
- If it finds a variable by that name, it will set it to 5.
- If if doesn't find it, it will create a new variable for *your*
gui and set it to 5
Similarly, in reading a variable:
say $MyVar
- Will search your gui, then the varpath, and if not found will
return with "" (nothing)
You can also have the GLOBAL variable list in your varpath. This is
denoted with the '*' character :
> VarPath "gui1/*/gui2/gui3"
- will search your gui first (always), then gui1, then the global
variable list, then gui2 then gui3.
The normal way to use Private vars in a multi-gui application, would
be to declare VARPATH with all the names of the guis the application
uses after it and access the global variables (if needed) using the
*MyVar system.
You don't have to declare the name of *your* gui in the varpath.
This will ALWAYS be checked first. If you do declare it, then it will
be searched twice.
If the variable is not found anywhere in the varpath and needs to be
created, then it will be added to *your* gui's variables.
(Unless specifically declared, as in - MyOtherGui.gc/MyVar = 5)