open-insight/FRAMEWORKS/STPROC/NDW_HTTP_LOGS_ARCHIVE_DATE_EVENTS.txt
2024-03-25 15:15:48 -07:00

200 lines
7.5 KiB
Plaintext

Function NDW_HTTP_Logs_Archive_Date_Events(CtrlEntId, Event, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15)
/***********************************************************************************************************************
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 : NDW_HTTP_Logs_Archive_Date_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)
09/23/19 dmb [SRPFW-278] Initial development.
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
#window NDW_HTTP_LOGS_ARCHIVE_DATE
$insert LOGICAL
$insert MSG_EQUATES
Equ EVENT_CONTINUE$ to 1
Equ EVENT_STOP$ to 0
Equ CR$ to \0D\
Equ CRLF$ to \0D0A\
Equ BACKSPACE$ to \08\
Equ TAB$ to \09\
Equ NEXT$ to 1
Equ PREVIOUS$ to 2
Declare subroutine Set_Property, Send_Event, Send_Message, PlaceDialog, End_Dialog
Declare function Get_Property, Dialog_Box
// Get the design time name of the window in case this is a multi-instance window.
Window = @Window[1, 'F*']
// 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 Event EQ 'OLE' then GoSub TransferParams
GoToEvent Event for CtrlEntID
If Event EQ 'OLE' then GoSub RestoreParams
Return EventFlow OR EVENT_CONTINUE$
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Events
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Event WINDOW.CREATE(CreateParam)
GoSub SetupOLEControls
PlaceDialog(-1, -1)
end event
Event PUB_OK.CLICK()
ArchiveDate = Get_Property(@Window : '.EDL_DATE', 'INVALUE')
End_Dialog(@Window, ArchiveDate)
// Since we are ending the window now, there is no need to allow the event chain to continue.
// If we do, then we will get the "labeled common variable has been freed and is no longer valid" error.
EventFlow = EVENT_STOP$
end event
Event EDL_DATE.OPTIONS()
CurrentDate = Get_Property(@Window : '.EDL_DATE', 'INVALUE')
NewDate = Dialog_Box('NDW_HTTP_DATEPICKER', @Window)
If CurrentDate NE NewDate then
Set_Property(CtrlEntId, 'INVALUE', NewDate)
end
end event
Event OLE_SUBCLASS.OnOptionClick(CtrlId)
Send_Event(CtrlId, 'OPTIONS')
end event
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal Gosubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
SetupOLEControls:
// All OLE controls can use this qualify configuration.
Qualify = ''
Qualify<1> = 1
Qualify<3> = ''
Qualify<4> = 0
//------------------------------------------------------------------------------------------------------------------
//
// SRP Subclass Control
//
//------------------------------------------------------------------------------------------------------------------
Ctrl = @Window : '.OLE_SUBCLASS'
EditCtrls = 'EDL_DATE'
NumCtrls = DCount(EditCtrls, ',')
For EditCnt = 1 to NumCtrls
EditCtrl = Field(EditCtrls, ',', EditCnt, 1)
Handle = Get_Property(@Window : '.' : EditCtrl, 'HANDLE')
Send_Message(Ctrl, 'OLE.Subclass', Handle, @Window : '.' : EditCtrl)
Set_Property(Ctrl, 'OLE.OptionButton[' : @Window : ';' : EditCtrl : ']', True$)
Set_Property(Ctrl, 'OLE.OptionImage[' : @Window : ';' : EditCtrl : ']', 'BMPS\SRPHTTPDateField.png')
Set_Property(Ctrl, 'OLE.Prompt[' : @Window : ';' : EditCtrl : ']', 'YYYY-MM-DD' : @FM : @FM : 'Center' : @FM : 'Center' : @FM : 'Segoe UI' : @SVM : 9 : @SVM : 400 : @VM : 0)
Send_Message(Ctrl, 'QUALIFY_EVENT', 'OLE.OnOptionClick', Qualify)
Next EditCnt
return
TransferParams:
// ActiveX controls pass their own event names through Param1. Modify the parameter values so they conform to
// OpenInsight event parameter values. This will allow commuter modules to be structured the same for OpenInsight
// event and ActiveX (OLE) events.
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
Transfer Param9 to Param8
Transfer Param10 to Param9
Transfer Param11 to Param10
Transfer Param12 to Param11
Transfer Param13 to Param12
Transfer Param14 to Param13
Transfer Param15 to Param14
return
RestoreParams:
// Restore the event parameters so the rest of the event chain will see the parameter values as they were originally
// created by OpenInsight. This will also prevent the parameter values from being transferred multiple times in case
// there are multiple OLE promoted event handlers (e.g. APPNAME*..OIWIN* and APPNAME*OLE..OIWIN*).
Transfer Param14 to Param15
Transfer Param13 to Param14
Transfer Param12 to Param13
Transfer Param11 to Param12
Transfer Param10 to Param11
Transfer Param9 to Param10
Transfer Param8 to Param9
Transfer Param7 to Param8
Transfer Param6 to Param7
Transfer Param5 to Param6
Transfer Param4 to Param5
Transfer Param3 to Param4
Transfer Param2 to Param3
Transfer Param1 to Param2
Transfer Event to Param1
Event = 'OLE'
return