Grid Management Library - Variable Names / Calling GML Programs
All GML variables begin with the letters GML. The variables associated with calling two of the three GML programs are as follows, and are used as part of the calling program argument lists:
GML_INIT$ |
GML initialization parameters |
GML$ |
Grid manager template |
GML_TPL$ |
Attribute and cell data (text) template |
GML_GM$ |
GML cell data (main) array |
GML_GC$ |
GML column header array |
GML_GR$ |
GML row header array |
GML_SET$ |
String variable |
Program GML_I is called by the workspace program one time during program startup as indicated by the following:
CALL "GML_I",SYSGUI,GML_INIT$,GML$,GML_GM$[ALL],GML_GC$[ALL],GML_GR$[ALL],GML_SET$
SYSGUI is the channel number of the SYSGUI Window.
Program GML_M is called by the workspace program when a notify event associated with object type 107 (grid control) occurs, as in the following example:
IF EVENT.OBJTYPE%=107 THEN IF EVENT.CODE$="N"
THEN GOSUB GML_M
GML_M:
CALL "GML_M",SYSGUI,EVENT$,NOTICE$,GML_SET$,GML_TPL$,GML$,
GML_GM$[ALL],GML_GC$[ALL],GML_GR$[ALL]
EVENT$ contains the event values received from the event queue template.
NOTICE$ contains values received from the grid notice template.
Program GML provides the interface to the Grid control(s) through the use of the GML template and associated procedures. The GML procedures have been created in a manner that minimizes the amount of code a developer is required to write when calling the GML program. The procedure name is also the label reference in the GML (called) program as appearing in the following example that initializes the GML_TPL$ template:
load the GML.SET% variable with the appropriate grid set number: GML.SET%=1
initialize the GML_TPL$ template: CALL "GML::TPL_PREP"
Since calling the GML program does not use an argument list, the called program (GML) shares all variables with the calling program. For this reason, program GML only contains variables that begin with the letters GML. Therefore, variables beginning with the letters GML must be considered as reserved for use by the GML and consequently not assigned by the developer for use in the application code.
If program GML is called from a called program, that program must have been called with the following variables as part of the argument list:
GML_TPL$,GML$,GML_GM$[ALL],GML_GC$[ALL],GML_GR$[ALL]
example:
REM MAIN_PROGRAM
.
CALL "PROGRAM_1",A$,B$,GML_TPL$,GML$,GML_GM$[ALL],GML_GC$[ALL],GML_GR$[ALL]
REM PROGRAM_1
.
ENTER A$,B$,GML_TPL$,GML$,GML_GM$[ALL],GML_GC$[ALL],GML_GR$[ALL]
.
.
GML.SET%=1
CALL "GML::TPL_PREP"
GML: Pre-Assigned Values
When program GML_I is called during program startup, template GML$ is loaded with values that can be used with certain procedures that relate to changing cell attributes. The field names are self explanatory and are as follows:
GML.BLACK$ |
GML.BLUE$ |
GML.CYAN$ |
GML.DKGRAY$ |
GML.GRAY$ |
GML.GREEN$ |
GML.LTGRAY$ |
GML.MAGENTA$ |
GML.RED$ |
GML.WHITE$ |
GML.YELLOW$ |
|
GML.CENTERED% |
GML.LEFT% |
GML.RIGHT% |
GML.CHECKED_CHECKBOX% |
GML.INPUTE% |
|
GML.RAISED_BUTTON% |
GML.RECESSED_BUTTON% |
GML.UNCHECKED_CHECKBOX% |
GML Start-Up: Calling Program GML_I
If an invalid value or a problem is encountered during start-up when calling program GML_I, variable GML.FLAG% will be assigned a negative value that corresponds to one of the following:
Value |
Meaning |
-401 |
GML_INIT$ template has not been initialized |
-402 |
Invalid value in GML_INIT.GR_TOT% variable |
-403 |
Invalid value in GML_INIT.LUM_QTY% variable |
-404 |
Problem obtaining main grid column count |
-405 |
Problem obtaining main grid row count |
-406 |
Problem obtaining main grid visual rows count |
-407 |
Problem deselecting main grid |
-408 |
(Reserved for future use) |
-409 |
MOD(main grid ID,5) not equal to 1 |
-410 |
Column header ID not equal to main grid ID +1 |
-411 |
Row header ID not equal to main grid ID +2 |
-412 |
Maximum cells exceeded |
-413 |
Problem obtaining dimensions of main grid |
-414 |
Problem obtaining dimensions of column header |
-415 |
Problem obtaining dimensions of row header |
-416 |
Invalid association between main grid control and column header controls |
-417 |
Invalid association between main grid control and row header control |
If a run time error occurs when calling program GML, GML_M, or GML_I, template variable GML.FLAG% will contain a negative value that corresponds to the VPRO/5 error code +1000. As an example, if program GML_I is called and an !ERROR 17 occurs (Invalid Parameter), the GML.FLAG% variable will contain a value of –1017 which will equate to –(Error Value+1000). In addition, template variable GML.NOTIFY% will contain a value that corresponds to the line number where the error occurred in program GML_I. However, if a run time error occurs in program GML_I prior to initialization of the GML$ template, testing the values in GML.FLAG% and GML.NOTIFY% would prove unsuccessful since these variable names would not exist. Therefore, a global variable STBL("GML_RT_ERROR") is also used to pass error information to the application. If a run time error occurs, as in the following Call/Enter Mismatch example, this global variable will contain the actual error number and error line number:
CALL "GML_I"
PRINT STBL("GML_RT_ERROR")
PROGRAM: GML_I, ERR: 36, LINE: 130, 12/30/99 AT 14:12:09
To insure proper start-up, the values in variables GML.FLAG% and STBL("GML_RT_ERROR") should be checked by the application immediately following the call to program GML_I.
Executing a GML Procedure
A procedure is always executed by calling program GML. If an invalid value or a problem is encountered during execution of the procedure by program GML, the variable GML.FLAG% will be assigned a negative value that corresponds to one of the following:
Value |
Meaning |
-1 |
invalid value in variable GML.SET% |
-2 |
invalid row number in variable GML_TPL.ROW_N% |
-3 |
operation not successful |
-4 |
GML_TPL$ template not initialized |
-5 |
GML_TPL.MEMBER% contains an invalid value |
-6 |
procedure not valid for value in GML_TPL.MEMBER% |
-7 |
wrong template initialized for the value contained in GML.SET% |
-8 |
invalid value in GML_TPL.OPTION% variable |
-9 |
procedure START_EDIT executed in non editable cell |
-10 |
invalid column number in variable GML_TPL.COL_N% |
-11 |
invalid value in GML_TPL.DEF_FLAG% variable |
-12 |
procedure START_EDIT executed on read only grid |
-13 |
RESTORE procedure executed on wrong row |
-14 |
(reserved) |
-15 |
(reserved) |
-16 |
(reserved) |
-17 |
RESTORE procedure executed with an incorrect value in GML_TPL.DEF_FLAG% |
-18 |
Problem encountered when executing the SORT procedure (GML_TPL.FLAG% variable contains the VPRO/5 error number, and GML_TPL.ROW_N% contains the grid row number causing the error). |
-19 |
SORT procedure executed while a cell was in the edit mode. |
-20 |
invalid value in GML_TPL.ROW_N% variable |
-21 |
invalid value in GML_TPL.COL_N% variable |
-22 |
Invalid value in GML_TPL.COL$[GML_TPL.COL_N%] variable |
-23 |
invalid value in GML_TPL.ARG% variable |
-24 |
invalid value in GML_TPL.SUP% variable |