Grid Management Library : Look-Up Manager (LUM) Feature
The Grid Management Library (GML) can be configured to associate a list type control, such as a list button or list edit, with a particular event that occurs on a specific column within a main grid cell. This feature provides the capability to temporarily show, at the location of a main grid cell, a list type control to be used to look-up and select information from a list of choices presented within the control. The GML administers the tasks associated with moving, sizing, showing, and hiding the look-up control. The portion of the GML that manages these tasks is referred to as the GML Look-Up Manager (LUM)
A template named GML_LUM$ is used to store the look-up parameters. The GML LUM is capable of managing more than one look-up, therefore an array subscript [n] is used to designate the assignment of look-up values. Variables within this template that require initialization by the application are as follows: ([n] indicates look-up number)
GML_LUM.LU_ID%[n] |
ID of the look-up control. |
GML_LUM.SET%[n] |
Set number of the associated grid. |
GML_LUM.COL%[n] |
Column number within the main grid that will be used to activate (display) the look-up control. |
GML_LUM.LOC%[n] |
Location where the look-up control is to be displayed, relative to column number assigned to the GML_LUM.COL%[n] variable. As an example, if variable GML_LUM.COL%[n] contains a value of 4 and variable GML_LUM.LOC%[n] is assigned a value of –1, then column 4 in the grid activates the look-up and the look-up control is displayed on the cell in column 3. If GML_LUM.LOC%[n] was assigned a value of 0, then the look-up control would be activated and displayed within the same cell within the column. Valid values for the GML_LUM.LOC%[n] are –1, 0 , and 1. |
GML_LUM.SCOPE%[n] |
Width of the look-up control. Each time a look-up control is displayed, it is moved and resized to overlay on the column identified by the sum of variables GML_LUM.COL%[n] and GML_LUM.LOC%[n |
GML_LUM.X_ADJ%[n] GML_LUM.Y_ADJ%[n] GML_LUM.W_ADJ%[n] |
The ADJ%[n] variables are used to adjust the placement of the look-up control. The values in these variable are initialized to +3 for X_ADJ%[n], +1 for Y_ADJ%[n], and –1 for W_ADJ%[n], but may be changed by the application. |
Additional Information
The effect of the value in variable GML_LUM.SCOPE%[n] on the look-up control width is based on values that are assigned to variable GML_LUM.LOC%[n].
EV = Event Column
LU = Look-Up control column
X = Scope (width) of control
GML_LUM.COL%[n]=3 |
GML_LUM.LOC%[n]=0 |
Grid Columns |
GML_LUM.SCOPE%[n] |
|
|
EV LU |
|
|
0 |
|
|
X |
|
|
1 |
|
X |
X |
|
|
2 |
|
|
X |
X |
|
3 |
|
X |
X |
X |
|
4 (width of grid control) |
X |
X |
X |
X |
X |
GML_LUM.COL%[n]=3 |
GML_LUM.LOC%[n]=-1 |
Grid Columns |
GML_LUM.SCOPE%[n] |
|
LU |
EV |
|
|
0 |
|
X |
|
|
|
1 |
|
X |
X |
|
|
2 |
|
X |
X |
X |
|
4 (width of grid control) |
X |
X |
X |
X |
X |
GML_LUM.COL%[n]=3 |
GML_LUM.LOC%[n]=1 |
Grid Columns |
GML_LUM.SCOPE%[n] |
|
|
EV |
LU |
|
0 |
|
|
|
X |
|
1 |
|
|
X |
X |
|
2 |
|
X |
X |
X |
|
4 (width of grid control) |
X |
X |
X |
X |
X |
GML Look-Up Manager (LUM) : Start-Up
The GML LUM feature is configured during application start-up as follows:
Step 1
At start-up, assign to GML_INIT$ variable GML_INIT.LUM_QTY% the quantity of look-up controls to be used by the application.
4130 LET GML_QTY%=2
4140 CALL "GML::START"
4150 LET GML_INIT.MAIN_ID%[1]=5001
4160 LET GML_INIT.COL_HEADER_ID%[1]=5002
4170 LET GML_INIT.ROW_HEADER_ID%[1]=0
4180 LET GML_INIT.SYSGUI%[1]=SYSGUI%
4190 LET GML_INIT.CONTEXT%[1]=1
4200 LET GML_INIT.MAIN_ID%[2]=5021
4210 LET GML_INIT.COL_HEADER_ID%[2]=5022
4220 LET GML_INIT.ROW_HEADER_ID%[2]=5023
4230 LET GML_INIT.SYSGUI%[2]=SYSGUI%
4240 LET GML_INIT.CONTEXT%[2]=2
4250 LET GML_INIT.LUM_QTY%=1
4260 CALL "GML_I",SYSGUI,GML_INIT$,GML$,GML_GM$[ALL],GML_GC$[ALL],
GML_GR$[ALL],GML_SET$
Step 2
Following the call to program GML_I, initialize the LUM template by executing the following procedure:
4340 REM +-----------------------+
4350 REM ! OBTAIN LUM TEMPLATE !
4360 REM +-----------------------+
4370 CALL "GML::INIT_LUM_TPL"
Step 3
Assign values to the GML_LUM$ template variables as appropriate:
4380 REM +---------------------+
4390 REM ! LU #1 INFORMATION !
4400 REM +---------------------+
4410 GML_LUM.LU_ID%[1]=122
4420 GML_LUM.SET%[1]=1
4430 GML_LUM.COL%[1]=2
4440 GML_LUM.LOC%[1]=0
4450 GML_LUM.SCOPE%[1]=0
The look-up control ID value of 122 in GML_LUM.LU_ID%[1] refers to a list button or list edit type control that exists at the time of GML_LUM$ template initialization. This control must exist in the same context as the grid control(s) in the grid set value assigned to variable GML_LUM.SET%[1]. In addition, the control should be visible, but placed beyond the width of the window. As an example, if the window width is 550 pixels, the x value of the look-up control should be greater than 550.
Step 4
Start the Look-Up Manager:
4620 REM +--------------------+
4630 REM ! START LU MANAGER !
4640 REM +--------------------+
4650 CALL "GML::LUM_START"
GML Look-Up Manager (LUM) : Displaying (Showing) The Look-Up Control
When grid event 14 (left click), 15 (left click current cell), or 18 (right click) occurs on the main grid (member 1) of a grid set, GML_TPL$ template variable GML_TPL.INFO$ contains information relating to the location of the click. This information can be passed on to the Look-Up Manager for displaying the look-up control in the row where the event was generated. The actual location of the control is determined by the values of the variables contained in the GML_LUM$ template that were initialized at the application start-up.
In the following example, GML.NOTIFY% 18 is being used as the event that activates (shows) the look-up control. If there is a control associated with the information contained in the GML_TPL$ template, that control is displayed. However, if no look-up control is associated with the GML_TPL$ information, the call to LUM_DISPLAY will have no effect.
7170 REM +------------------+
7180 REM ! RIGHT CLICK !
7190 REM ! GML.NOTIFY%=18 !
7200 REM +------------------+
7210 CASE 18
7220 SWITCH GML_TPL.MEMBER%
7230 CASE 1
7240 IF GML_TPL.FLAG%=1 THEN CALL "GML::LUM_DISPLAY"
7250 BREAK
7260 CASE 2