$ObjErrHelpFile

Provides the name of the help file that the component provided when an exception was raised.

Syntax

$ObjErrHelpFile

Return Value

Character string (VARALPHA). Can be reset by an application program.

Comments

The variable provides the name of the help file that the component provided when an exception was raised because of an  improper operation. This variable is set to $null when a component operation triggers a Zim error but is set to a meaningful value when a Zim 5207 error is encountered.

Warning

COM objects are being discontinued by Microsoft and may not be available in future releases of Zim-X.

$ObjException

A variable set when an exception occurs.

Syntax

$ObjException

Return Value

Number (LONGINT) Can be reset by an application program.

Comments

This variable is set only when a Zim error 5207 is generated (when the component application wishes to raise an exception). When an exception is raised, this variable is set as well as $ObjErrCode, $ObjErrDescription, $ObjErrHelpFile, $ObjErrHelpTopic and $ObjErrObjectType.

Warning

COM objects are being discontinued by Microsoft and may not be available in future releases of Zim-X.

$ObjErrHelpTopic

Provides a topic number for the help file provided by $ObjErrHelpFile.

Syntax

$ObjErrHelpTopic

Return Value

Number (LONGINT). Can be reset by an application program.

Comments

The variable provides a topic number for the help file provided by the $ObjErrHelpFile. This topic number does not apply to all help files formats. This variable is set to $null when a component operation triggers a Zim error but is set to a meaningful value when a Zim 5207 error is encountered.

Warning

COM objects are being discontinued by Microsoft and may not be available in future releases of Zim-X.

$ObjErrParameter

Provides the number of the parameter that caused an error.

Syntax

$ObjErrParameter

Return Value

Number (INT). Can be reset by an application program.

Comments

If a Zim error of 5201 (Unknown Parameter) or 5202 (Type Mismatch) occurs, the $ObjErrParameter is set to the number of the parameter that caused the error. If the 5201 error occurs and the $ObjErrParameter is $null, the method or property name is unknown. This variable is reset when an error is triggered that was caused by a component operation.

Warning

COM objects are being discontinued by Microsoft and may not be available in future releases of Zim-X.

$ObjGetEvent

Obtain the oldest event generated by a COM component.

Syntax

$ObjGetEvent (Object)

Parameters

Objectan object variable or formfield of type OLE

Return Value

Returns a result as per the specification of the object.

Note: Zim attempts to convert to the assigned type. Ensure a proper variable type is assigned.

Comments

COM objects can generate synchronous or asynchronous events. In any case, they will be stacked up until removed by a $ObjGetEvent function invocation. Later, the parameters associated to this event can be queried using the $ObjEventParameter function.

Is up to the programmer’s responsibility to know whether the object raises events and what is the structure of these events.

Example

This example creates a component, runs a specific method and then queries the events by retrieving its parameters:

let vObject = $ObjCreate('MyObject.Anything')
let vResponse = $ObjRunMethod(vObject, 'MyMethod', 'AParameter')
let vResponse = $ObjGetEvent(vObject)
if ($ObjEventName = 'MyEvent')
out $objeventparameter(1)
out $objeventparameter(2)
else
...
endif
let vResponse = $ObjDestroy(vObject)

Warning

COM objects are being discontinued by Microsoft and may not be available in future releases of Zim-X.

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:

$ClipPathPath to the disk directory to be used for Cut, Copy, and Paste operations that involve user interface objects in the Screen Painter.
$DBCharSetIndicates the character set used by the application database.
$DBPathPath to the disk directory in which the application database is stored.
$FalseA “binary” false value for comparison.
$ImagePathPath to the disk directory containing image files for use in forms.
$NullA “null” value for comparison.
$TimeSecsThe elapsed number of seconds since 12:00am, 1 January 1970.
$TrueA “binary” true value for comparison.
$WorkPathPath to the disk directory where the application users’ work fields can be found (specified in a Zim configuration file).
$ZimOSIdentifies the operating system in use.
$ZimPathPath to the disk directory in which the Zim software is installed.
$ZimProductIdentifies the Zim product currently being used.
$ZimVersionIdentifies 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:

$DateThe current date.
$GroupIDThe current user’s operating system group identifier.
$TimeThe current time.
$UserIDThe 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.EventNameThe last event to occur.
Event.EventTagThe object in which the last event occurred.
Event.EventTypeThe type of event that last occurred.
Event.FieldTagThe current field at the time of the last event.
Event.FormTagThe current form at the time of the last event.
Event.KeyPressedThe key that, when pressed, caused the last event to occur.
Event.MenuItemTagThe selected item on the menu in the current window at the time of the last event.
Event.MenuTagThe current menu at the time of the last event.
Event.MouseClickIf a mouse button accelerator caused an event to occur.
Event.ScrollingKeyIf an event corresponds to a defined SCROLL key.
Event.WindowTagThe current window at the time of the last event.

Text Cursor Positioning

$CursorCol, $CursorRowThe location of focus in a window when an event occurs.
$CursorScreenCol, $CursorScreenRowThe location of focus on the screen when an event occurs.
$DirectionThe direction in which focus was moving when an event occurs.

Error Status

$ErrCodeThe error code generated by the last command executed.
$ErrLevelThe error severity level generated by the last command executed.
$LastErrCodeThe error code generated by the last command that returned an error code.
$LastErrLevelThe error severity level generated by the last command that returned an error severity level.

 

$LastErrMessageThe error message generated by the last command that returned an error code.
$MaxErrLevelThe highest error severity level generated during the application session.
$SQLErrCodeThe error code returned from the SQL database.
$SQLErrMsgThe error message returned from the SQL database.

Other Status Conditions

$BreakFlagIf the application user has pressed the “break” key.
$DeadlockReasonThe reason that a deadlock condition occurred.
$InTransactionIf an explicit transaction is in progress.
$LocatedThe number of records located by a LOCATE command.
$MemberCountThe number of records processed by a set-processing command.
$PageThe current page number in a report.
$SetCountThe number of records found by the last FIND command.

External Programs

$EditorThe name of a text editor software package.
$GraphicsThe name of a graphics software package.
$HelpFileThe name of a disk file containing online help.

Security

$ZGroupIDThe application user’s Zim group identifier.
$ZUserIDThe 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.EventNameThe last event that occurred in the current window.
ThisWindow.EventTagThe identification tag of the object in which the last event in the current window occurred.
ThisWindow.EventTypeThe type of event that last occurred in the current window.
ThisWindow.KeyPressedThe key that, when pressed, caused the event that last occurred in the current window.
ThisWindow.MouseClickIf a mouse button accelerator caused the event that last occurred in the current window.
ThisWindow.ScrollingKeyIf 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,
ThisWindow.WindowNum,
ThisWindow.WindowTag

The current window
ThisWindow.WindowStateIf the current window is maximized, minimized, or otherwise.

Miscellaneous

$WindowPSHeight, WindowPSWidthThe 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.MenuchangedIf 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.DisplayTagThe display that had focus at the time of the last event in the current window.
ThisForm.FieldChangedA 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.FormChangedA 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.SubscriptThe 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.

</td>

Editing a Compiled Program

If you attempt to edit a compiled program (using the EDIT command), a message is issued, warning you that the program has been compiled. Knowing that a program you are modifying has been compiled enables you to choose whether to re-compile it or to run the uncompiled version. You must choose one of these alternatives for the changes that you have made to take effect.

Checking If a Program is Compiled

You can use one of the following methods to determine if a program has been compiled:

  • Use the $compilestatus function to check the compilation status of the program.
  • Run the Object Browser ( ZXLISTER) administrative utility. Any application document containing a compiled program shows a “-c” suffix following the file name.
  • Attempt to use the EDIT command to edit the program from within Zim. If the program has been compiled, a warning message is issued.
  • Issue a SET FLOW ON command. With FLOW set to ON, any call to a procedure produces a message indicating if the calling procedure is a compiled program.
  • Uncompile the program using the UNCOMPILE command. If the program was not compiled, an error message is issued.

The Lifetime of a Compiled Program

You can recompile an application program at any time. Recompiling replaces the existing compiled version of the program with a new compiled version. Recompiling is necessary if a compiled program becomes invalid for one of the following reasons:

  • The source version of the program has been updated.

Changes to the source program are not automatically reflected in the compiled version. Re-compile the program after making the changes. (The software issues a warning about this situation when you execute an EDIT command involving an application document that contains a source program.)

  • Objects have been changed.

Changes to objects (through the CREATE and ERASE commands) invalidate all compiled programs that use the affected objects. Ensure that all such “out-of-date” programs are re-compiled.

Zim provides mechanisms for automatically storing dependency information (e.g., a program’s references to objects). (For more information, see the DEPENDENCY command).

pt_BRPortuguese