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

100 lines
4.8 KiB
Plaintext

Compile insert Event_Setup
/***********************************************************************************************************************
This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written
permission from SRP Computer Solutions, Inc.
Name : Event_Setup
Description : Declarations and equates used by the form event commuters.
Notes : Event_Setup also populates several variables that will often be useful within event handler code.
History : (Date, Initials, Notes)
08/13/10 dmb Original programmer.
***********************************************************************************************************************/
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
Equ EVENT_SYSTEM_ONLY$ to 4 ; // Event flow should execute the system event handler only (normal option for third-party windows running in FrameWorks)
// 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*']
MDIFrame = Get_Property(@Window, 'MDIFRAME')
Parent = Get_Property(@Window, 'PARENT')
If MDIFrame EQ '' then MDIFrame = Parent ; // Dialog boxes won't set the MDIFRAME property so use the PARENT property.
// Always get the CtrlClassID since we are not passing it through the event parameters.
CtrlClassId = Get_Property(CtrlEntId, 'TYPE')
// Get the name of the control on the window based on the CtrlClassId.
Begin Case
Case CtrlClassId EQ 'WINDOW'
Control = Window
Case CtrlClassId EQ 'RADIOBUTTON'
Control = Field(CtrlEntId, '.', 2, 2)
Case CtrlClassId EQ 'MENU'
Control = CtrlEntId[-1, 'B.']
Case 1
Control = Field(CtrlEntId, '.', 2, 1)
End Case
// 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, 'ATRECORD')
// 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