open-insight/LSL2/STPROCINS/SRP_EVENT_SETUP.txt
2024-03-25 15:12:53 -07:00

74 lines
3.3 KiB
Plaintext

Compile insert SRP_EVENT_SETUP
Declare function Get_Property, Set_Property, Get_Current_Event, Get_Window_ID, Get_Record
// Return values to indicate how the event flow should continue.
Equ EVENT_STOP$ to 0 ; // Event flow should stop
Equ EVENT_CONTINUE$ to 1 ; // Event flow should continue until a later process changes this value
Equ EVENT_CONTINUE_NO_PROMOTED$ to 2 ; // Event flow should by-pass the promoted (generic) logic but allow the system event handler to execute
Equ EVENT_CONTINUE_NO_SYSTEM$ to 3 ; // Event flow should execute the promoted (generic) logic but stop the system event handler from executing
// Make sure any event parameters which have not been assigned are nulled.
If Assigned(CtrlEntId) else CtrlEntId = ""
If Assigned(Event) else Event = ""
If Assigned(Param1) else Param1 = ""
If Assigned(Param2) else Param2 = ""
If Assigned(Param3) else Param3 = ""
If Assigned(Param4) else Param4 = ""
If Assigned(Param5) else Param5 = ""
If Assigned(Param6) else Param6 = ""
If Assigned(Param7) else Param7 = ""
If Assigned(Param8) else Param8 = ""
If Assigned(Param9) else Param9 = ""
If Assigned(Param10) else Param10 = ""
If Assigned(Param11) else Param11 = ""
If Assigned(Param12) else Param12 = ""
If Assigned(Param13) else Param13 = ""
If Assigned(Param14) else Param14 = ""
If Assigned(Param15) else Param15 = ""
// Get the design time name of the window in case this is a multi-instance window.
Window = @Window[1, "F*"]
// Get the name of the control on the window. Get all reasonable parts of the control name.
Control = Field(CtrlEntId, ".", 2, 3)
// If there is no control then assume the window is the control.
If Control EQ "" then Control = Window
// Always get the CtrlClassID since we are not passing it through the event parameters.
CtrlClassId = Get_Property(CtrlEntId, "TYPE")
// If this is an OLE control, get the ProgID.
ProgID = ""
If CtrlClassId EQ "OLECONTROL" then ProgID = Get_Property(CtrlEntId, "ORIG_TEXT")
// Get the Event Type so generic event functionality can be executed properly.
EventType = Get_Current_Event()
// Combine the event type and control into an event action
If EventType EQ "OLE" then
// Because the Promoted_Events function transfers parameters, this will only appear correctly in a commuter module.
EventAction = Event:".":Control
end else
EventAction = EventType:".":Control
end
// Get the current window's key ID. Strip off the @SVM if this window is ignoring self-locks.
KeyID = Get_Property(@Window, "ID")[1, "F":@SVM]
// If KeyID is null then check to see if the key controls are populated. If so, then this is
// probably a locked record. ID properties are null with locked records.
* If KeyID EQ "" then
* KeyID = Get_Window_ID(@Window)
* end
// Get the current window's record.
Record = Get_Property(@Window, "RECORD")
// If the window uses QuickEvents to call the commuter module, check for @EVENT in the
// event parameter. This is here for backwards compatability. OpenInsight 7.1 and higher
// automatically swaps @EVENT with the actual event. Prior versions of OpenInsight will
// just pass the literal through. Therefore, this will swap out @EVENT with the actual event.
If Event EQ "@EVENT" then Swap "@EVENT" with EventType in Event