GML Look-Up Manager (LUM) : Responding To Events
Description
The GML LUM must be called when list edit or list button events occur (GOSUB LUM_LOOK_UP). In addition, when other events occur, the LUM must be called to determine when to hide a look-up control (GOSUB LUM_EVENT) that is visible (GML_LUM_FLAG%<>0 ), but focus has been moved elsewhere. Line 3650 as follows is an example that contains the necessary code to provide access to the subroutines that provide access to the GML LUM to administer the events. This line of code should must be inserted in the application immediately following the line of code that transfers program control to the routine that manages the grid events (see line 3640).
The actual location of the following code, and names of sub routines are application specific. The following is intended to illustrate the items necessary to manage the events.
|
LUM_LOOK_UP Subroutine
In the LUM_LOOK_UP subroutine, the event ID is placed in GML_LUM.EVENT_ID% and the event context is placed in GML_LUM.EVENT_CONTEXT% variables. The Look-Up Manager is then called by executing the call to the GML to find the index of the look-up control identified by the event ID and context.
|
If after execution of the call to the GML, variable GML_LUM.LU_SET% contains a 0 (the control is not a look-up type control), the subroutine ends by branching to the RETURN in line 8010
7690 IF GML_LUM.LU_SET%=0 THEN GOTO 8010
In the next portion of the subroutine, template variable NOTICE.CODE% is used with the SWITCH verb to determine how to manage the event (see VPRO/5 documentation relating to List Button and List Edit Notify Events for more information)
When an event is generated by a list opened (CASE 1) no action is necessary, and the subroutine ends.
|
When an item is selected, the value of the GML_LUM.LU_SET% variable is placed into the GML.SET% variable. GML is called to prepare the GML_TPL$ template, and then GML LUM is called to get the text from the look-up control that generated the event. GML LUM places the text into the GML_TPL$ template GML_TPL.COL$[n] variable. The [n] is the sum of values in variables GML_LUM.COL%[GML_LUM.LU_SET%] and GML_LUM.LOC%[GML_LUM.LU_SET%]. The event row number is placed in the GML_TPL.ROW_N% variable. The POPULATE procedure is then executed to update the text in the main grid cell.
|
When an event is generated by a list closed (CASE 3) or a cancellation of the selection process (CASE 4), GML LUM is called to hide the control.
|
When an event is generated by a selection change (CASE 5), no action is necessary, and the subroutine ends.
|
Listing of the LUM_LOOK_UP Subroutine:
|
LUM_EVENT Subroutine
3650 IF EVENT.CODE$="N" AND NOTICE.OBJTYPE%>18 AND NOTICE.OBJTYPE%<21
THEN GOSUB LUM_LOOK_UP
ELSE IF EVENT.CODE$<>"m" AND GML.LUM_FLAG% THEN GOSUB LUM_EVENT
Program control is transferred to the LUM_EVENT subroutine when the value of variable GML.LUM_FLAG% is not equal to 0, and an event other than a list control or mouse event has occurred. In the LUM_EVENT subroutine, the event ID is placed in GML_LUM.EVENT_ID% and the event context is placed in GML_LUM.EVENT_CONTEXT% variable. The Look-Up Manager is then called by executing a call to the GML to determine if the look-up control has lost focus, and hide the control as required.
|