Generated Program Variables
This is a list of the variables and functions available to developers in programs generated by GUIBuilder.
Variables Available in All Parts of the Program (including Initialization and End of Job):
Variable |
Description |
gb__arg$ |
Argument passed in a CALL statement and retrieved in the ENTER line of the generated program. |
gb__args |
Number of values passed in gb__arg$.gb__args will be -1 if gb__arg$ is a simple variable (without a template), 0 if the program was run (or if the program was called and gb__arg$ was not passed), or a positive integer to indicate the number of fields defined in the string template associated with gb__arg$. |
gb__sysgui$ |
Name of the SYSGUI alias, taken from the config.bbx file. |
gb__sysgui |
Channel on which the SYSGUI device (gb__sysgui$) is opened. |
gb__sysprint$ |
Name of the SYSPRINT alias, if one was defined in config.bbx. If no SYSPRINT device exists in config.bbx, then gb__sysprint$ will be null (""). |
gb__win_id$ |
Initialization: The first window ID found in the resource file. |
gb__win$ |
Template associated with this string contains each of the form and window names defined in this program's resource file; the value of each field is the context of the given form or window. For example, if a form is named "Main" and its context is 0, then gb__win.main will be 0. |
Variables Available Only within the Event Loop
Variable |
Description |
gb__event$ |
Event record. It is dimensioned using TMPL(gb__sysgui). The event record is documented in the Visual PRO/5 GUI Guide. |
gb__notice$ |
Notice string for the current Notify event. This string is only meaningful if gb__event.code$ is "N." It will be dimensioned with the correct template based on the notify type. |
gb__win_id$ |
Current window ID. For example, if the current window is a top-level form with an ID of 100, then gb__win_id$ is "100." If the current window is a child window with an ID of 1001 on a top-level form of 100, then gb__win_id$ is "100.1001."Child windows can be nested to an arbitrary level, so it's possible to see gb__win_id$ as "100.1111.2222.3333." |
gb__eoj |
This variable can be set to any non-zero value to force termination of the event loop. |
Both gb__event$ and gb__notice$ are set at the top of the event loop:
dim gb__event$:tmpl(gb__sysgui)
gb__event=len(gb__event$)
dim gb__generic$:noticetpl(0,0)
gb__eoj=0
repeat
read record (gb__sysgui,siz=gb__event,err=gb__event_loop_end)gb__event$
if gb__event.code$="N" then
: gb__generic$=notice(gb__sysgui,gb__event.x%);
: dim gb__notice$:noticetpl(gb__generic.objtype%,gb__event.flags%);
: gb__notice$=gb__generic$
body of the event loop
until gb__eoj
Note that all variables defined by the framework start with gb__ (with two underscores). Similarly, all functions defined by the framework start with fngb__.