open-insight/LSL2/STPROC/NDW_UNLOCK_KEYID_EVENTS.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

167 lines
6.6 KiB
Plaintext

Function NDW_Unlock_KeyID_Events(CtrlEntId, Event, @PARAMS)
/***********************************************************************************************************************
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 Infineon.
Name : NDW_Unlock_KeyID_Events
Description : This function acts as a commuter module for all events related to this window.
Notes : Commuter Modules are automatically called from the Promoted_Events function which is called by the
application-specific promoted event handler. This makes it possible to add QuickEvents that need to
execute Basic+ logic without having use the Form Designer to make the association, although this is
limited to the events which are currently promoted.
If the form needs to call the commuter module directly then the QuickEvent parameters should be
formatted like this:
'@SELF','@EVENT',['@PARAM1','@PARAMx']
Parameters :
CtrlEntId [in] -- The fully qualified name of the control calling the promoted event
Event [in] -- The event being executed. See the Notes section regarding "PRE" events
Param1-15 [in] -- Additional event parameter holders
EventFlow [out] -- Set to 1 or 0 so the calling event knows whether or not to chain forward. See comments in
EVENT_SETUP insert
History : (Date, Initials, Notes)
05/29/18 dmb Created initial commuter module. - [IREPIOI-29]
06/16/18 dmb Replace DATABASE_SERVICES\UnlockKeyID service with MESSAGING_SERVICES\ReleaseLock service
since it has the ability to ask the each session to release its own lock. - [IREPIOI-29]
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
#Window NDW_UNLOCK_KEYID
$insert APP_INSERTS
$insert EVENT_SETUP
$insert MSG_EQUATES
Declare subroutine SRP_Show_Window, Placedialog, Messaging_Services
Declare function Database_Services, Messaging_Services
SubclassInfo = Form_Services('FindSubclassControl')
Subclass = SubclassInfo<1>
// Update the arguments so that the OpenInsight OLE event will treate the ActiveX event as a native event handler.
If Event EQ 'OLE' then
Transfer Event to OIEvent
Transfer Param1 to Event
Transfer Param2 to Param1
Transfer Param3 to Param2
* Transfer Param4 to Param3
* Transfer Param5 to Param4
* Transfer Param6 to Param5
* Transfer Param7 to Param6
* Transfer Param8 to Param7
end
GoToEvent Event for CtrlEntID
Return EventFlow else EVENT_CONTINUE$
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Events
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Event WINDOW.CREATE(CreateParam)
GoSub Setup_OLE_Controls
Set_Property(@Window : '.PUB_CLOSE', 'NEXT', @Window : '.EDL_TABLE_NAME')
SRP_Show_Window(@Window, 'SYSTEM', 'C', 'C', 1, '', False$, False$)
Placedialog(-2, -2)
end event
Event WINDOW.OMNIEVENT(Message, Param1, Param2, Param3, Param4)
Begin Case
Case Message _EQC 'ReleaseLock'
AtStation = Param1[1, @FM]
AtUser4 = Param1[Col2() + 1, @FM]
AtUserName = Param1[Col2() + 1, @FM]
ProcessID = Param1[Col2() + 1, @FM]
TableName = Param1[Col2() + 1, @FM]
KeyID = Param1[Col2() + 1, @FM]
Message = 'The following lock was successfully released:' : @TM : @TM
Message := 'Table Name : ' : TableName[-1, 'B '] : @TM
Message := 'Key ID : ' : KeyID[-1, 'B '] : @TM
Message := 'User : ' : AtUser4[-1, 'B '] : @TM
Message := 'Station : ' : AtStation[-1, 'B ']
Form_Services('DisplayControlMessage', Message, 'Unlock Key ID', @Window : '.EDL_KEY_ID', 'HELP', 'Select L=30')
End Case
end event
Event EDL_TABLE_NAME.GOTFOCUS(PrevFocusID)
end event
Event EDL_KEY_ID.LOSTFOCUS(Flag, FocusID)
Form_Services('CloseControlMessage', CtrlEntId)
end event
Event EDL_KEY_ID.CHAR(VirtCode, ScanCode, CtrlKey, ShiftKey, AltKey)
Form_Services('CloseControlMessage', CtrlEntId)
end event
Event PUB_OK.LOSTFOCUS(Flag, FocusID)
Form_Services('CloseControlMessage', @Window : '.EDL_KEY_ID')
end event
Event PUB_OK.CLICK()
TableName = Get_Property(@Window : '.EDL_TABLE_NAME', 'TEXT')
KeyID = Get_Property(@Window : '.EDL_KEY_ID', 'TEXT')
IsKeyIDLocked = Database_Services('IsKeyIDLocked', TableName, KeyID)
If IsKeyIDLocked EQ True$ then
Messaging_Services('SendMessage', 'ReleaseLock', 'Request', @Station, 'All', TableName : ',' : KeyID, 'EventHandler', @Window : ',OMNIEVENT,@MESSAGE,@ARGUMENTS', False$)
* KeyIDUnlocked = Database_Services('UnlockKeyID', TableName, KeyID)
* If KeyIDUnlocked EQ True$ then
* Message = KeyID : ' was unlocked in table ' : TableName : ' successfully. '
* Form_Services('DisplayControlMessage', Message, 'Unlock Key ID', @Window : '.EDL_KEY_ID', 'HELP', 'Select L=30')
* end else
* Message = Error_Services('GetMessage')
* If Message EQ '' then Message = 'Unable to unlock ' : KeyID : ' in table ' : TableName : '. '
* Form_Services('DisplayControlMessage', Message, 'Unlock Key ID', @Window : '.EDL_KEY_ID', 'VALIDATION', 'RGB(229,20,0)')
* end
end else
Set_Property(@Window : '.EDL_KEY_ID', 'FOCUS', True$)
Set_Property(@Window : '.EDL_KEY_ID', 'SELECTION', 1 : @FM : 999)
Message = KeyID : ' was not locked in table ' : TableName : '. '
Form_Services('DisplayControlMessage', Message, 'Unlock Key ID', @Window : '.EDL_KEY_ID', 'VALIDATION', 'RGB(229,20,0)')
end
end event
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Setup_OLE_Controls:
Qualify = ''
Qualify<1> = 1
Qualify<4> = 0
return