System Variables
The software maintains a series of system variables that represent either fixed values ($ZimOS) or values that fluctuate dynamically with the current status of the software ($InTransaction) or of application objects (ThisWindow.WindowTag).
System variables resemble global variables in nature. The software automatically sets or resets the values of system variables to reflect the status of the software and the current application. In some cases, an application program can also reset them.
A system variable name can be used as an atomic expression denoting the value currently held in the memory location associated with the variable. A system variable name can be used almost anywhere that a literal can be used.
Available System Variables
System variables are categorized into those that supply information about windows, those that supply information about menus, those that supply information about forms, and those that supply general information. Some system variables are “binary” in nature in that they evaluate only to ‘1’ ($True) or ‘0’ ($False), while others may be set to a variety of values.
General-use System Variables with “Permanent” Values
Given a particular version of the software, the following system variables have the same value at all times during an application session:
$ClipPath | Path to the disk directory to be used for Cut, Copy, and Paste operations that involve user interface objects in the Screen Painter. |
$DBCharSet | Indicates the character set used by the application database. |
$DBPath | Path to the disk directory in which the application database is stored. |
$False | A “binary” false value for comparison. |
$ImagePath | Path to the disk directory containing image files for use in forms. |
$Null | A “null” value for comparison. |
$TimeSecs | The elapsed number of seconds since 12:00am, 1 January 1970. |
$True | A “binary” true value for comparison. |
$WorkPath | Path to the disk directory where the application users’ work fields can be found (specified in a Zim configuration file). |
$ZimOS | Identifies the operating system in use. |
$ZimPath | Path to the disk directory in which the Zim software is installed. |
$ZimProduct | Identifies the Zim product currently being used. |
$ZimVersion | Identifies the Zim version currently being used. |
General-use System Variables with Values Derived from the Operating System
The software sets the values of the following system variables based on current values obtained from the operating system:
$Date | The current date. |
$GroupID | The current user’s operating system group identifier. |
$ScreenHeight, $ScreenWidth | The size of the terminal screen in character rows/columns. |
$Time | The current time. |
$UserID | The current user’s operating system user identifier. |
System Variables Periodically Set/Reset by the Software or the Application System
The values of these variables are set and reset depending on conditions encountered during execution of the application. An application program can assign a value to any of these variables at any time; however, the assigned value can be overwritten as conditions subsequently change during the application session.
Last Callback Event
Event is a data structure that provides information about the application environment the time of the most recent callback even. Each variable in the structure provides one item of information. The values of these variables are reset each time a callback event returns control to the application program. An application program can assign a value to any of these variables at any time; however, the assigned value is overwritten the next time that a callback event occurs.
Event.AltKey, Event.CtrlKey, Event.ShiftKey |
The state of the Alt, Ctrl, and Shift keys during the last event. |
Event.EventName | The last event to occur. |
Event.EventTag | The object in which the last event occurred. |
Event.EventType | The type of event that last occurred. |
Event.FieldTag | The current field at the time of the last event. |
Event.FormTag | The current form at the time of the last event. |
Event.KeyPressed | The key that, when pressed, caused the last event to occur. |
Event.MenuItemTag | The selected item on the menu in the current window at the time of the last event. |
Event.MenuTag | The current menu at the time of the last event. |
Event.MouseClick | If a mouse button accelerator caused an event to occur. |
Event.ScrollingKey | If an event corresponds to a defined SCROLL key. |
Event.WindowTag | The current window at the time of the last event. |
Text Cursor Positioning
$CursorCol, $CursorRow | The location of focus in a window when an event occurs. |
$CursorScreenCol, $CursorScreenRow | The location of focus on the screen when an event occurs. |
$Direction | The direction in which focus was moving when an event occurs. |
Error Status
$ErrCode | The error code generated by the last command executed. |
$ErrLevel | The error severity level generated by the last command executed. |
$LastErrCode | The error code generated by the last command that returned an error code. |
$LastErrLevel | The error severity level generated by the last command that returned an error severity level. |
$LastErrMessage | The error message generated by the last command that returned an error code. |
$MaxErrLevel | The highest error severity level generated during the application session. |
$SQLErrCode | The error code returned from the SQL database. |
$SQLErrMsg | The error message returned from the SQL database. |
Other Status Conditions
$BreakFlag | If the application user has pressed the “break” key. |
$DeadlockReason | The reason that a deadlock condition occurred. |
$InTransaction | If an explicit transaction is in progress. |
$Located | The number of records located by a LOCATE command. |
$MemberCount | The number of records processed by a set-processing command. |
$Page | The current page number in a report. |
$SetCount | The number of records found by the last FIND command. |
External Programs
$Editor | The name of a text editor software package. |
$Graphics | The name of a graphics software package. |
$HelpFile | The name of a disk file containing online help. |
Security
$ZGroupID | The application user’s Zim group identifier. |
$ZUserID | The application user’s Zim user identifier. |
System Variables Concerned with Windows
Last Event in the Current Window
ThisWindow is a data structure that provides information about the state of the application environment and of the current window at the time of the last event in that window. Each variable in the structure provides one item of information. The values of these variables are reset each time a window becomes the current window. An application program can assign a value to any of these variables at any time; however, the assigned value is overwritten the next time that another window becomes the current window.
ThisWindow.AltKey, ThisWindow.CtrlKey, ThisWindow.ShiftKey |
The state of the Alt, Ctrl, and Shift keys at the time of the last event in the current window. |
ThisWindow.EventName | The last event that occurred in the current window. |
ThisWindow.EventTag | The identification tag of the object in which the last event in the current window occurred. |
ThisWindow.EventType | The type of event that last occurred in the current window. |
ThisWindow.KeyPressed | The key that, when pressed, caused the event that last occurred in the current window. |
ThisWindow.MouseClick | If a mouse button accelerator caused the event that last occurred in the current window. |
ThisWindow.ScrollingKey | If the accelerator that caused the event that last occurred was also a defined SCROLL key. |
ThisWindow.WindowCol, ThisWindow.WindowRow |
The character column and character row position of the current window. |
ThisWindow.WindowHeight, ThisWindow.WindowWidth |
The physical size of the current window in character rows and columns. |
ThisWindow.WindowName, |
The current window |
ThisWindow.WindowState | If the current window is maximized, minimized, or otherwise. |
Miscellaneous
$WindowPSHeight, WindowPSWidth | The logical size of the current window in character rows and columns. |
System Variables Concerned with Menus
Last Event in the Current Menu
ThisMenu is a data structure that provides information about the state of the software environment and of the current menu at the time of the last event in that menu. Each variable in the structure provides one item of information. The values of these variables are reset each time that FORM or MENU INPUT terminates. An application program can assign a value to any of these variables at any time; however, the assigned value is overwritten the next time that FORM or MENU INPUT terminates.
ThisMenu.Menuchanged | If any menu item in the current menu has been modified by the application use at the time of the last event in the current window. |
ThisMenu.MenuItemNum, ThisMenu.MenuItemTag |
The selected item on the menu at the time of the last event in the current window. |
ThisMenu.MenuNum ThisMenu.MenuTag |
The current menu at the time of the last event in the current window. |
System Variables Concerned with Forms
Last Event in the Current Form/Display
ThisForm is a data structure that provides information about the state of the current form/display at the time of the last event in the current window. Each variable in the structure provides one item of information. The values of these variables are reset each time that FROM or MENU INPUT terminates, An application program can assign a value to any of these variables at any time; however, the assigned value is overwritten the next time that FORM or MENU INPUT terminates.
ThisForm.DisplayTag | The display that had focus at the time of the last event in the current window. |
ThisForm.FieldChanged | A code indicated if the form field that had focus at the time of the last event in the current window was modified by the application user. |
ThisForm.FFFieldNum, ThisForm.FieldTag |
The form field that had focus at the time of the last event in the current window. |
ThisForm.FormChanged | A code indicating if any form field in the form or display had been modified by the application user at the time of the last event in the current window. |
ThisForm.FormNum, ThisForm.FormTag |
The form that had focus at the time of the last event in the current window. |
ThisForm.ReqError, ThisForm.ReqFieldNum, ThisForm.ReqFormNum, ThisForm.ReqSubscript, ThisForm.ReqTag |
If all required form fields had values at the time of the last event in the current window. |
ThisForm.Subscript | The instance of the form where focus was located at the time of the last event in the current window. |
ThisForm.ValError, ThisForm.ValFieldNum, ThisForm.ValFormNum. ThisForm.ValSubscript, ThisForm.ValTag |
If all form fields contained valid values at the time of the last event in the current window. |