Compile function NDW_REC_SEND_EVENTS(CtrlEntId, Event, @PARAMS) #pragma precomp SRP_PreCompiler #window NDW_REC_SEND $Insert EVENT_SETUP $Insert APP_INSERTS Declare function Database_Services, SRP_Array Declare subroutine Database_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 else // Event not implemented end Return EventFlow or 1 //----------------------------------------------------------------------------- // EVENT HANDLERS //----------------------------------------------------------------------------- Event WINDOW.CREATE(CreateParam) GoSub Setup_OLE_Controls FormSize = '' SRP_Show_Window(@Window, '', 'C', 'C', 1, '', False$, False$, FormSize) End Event Event OLE_SUBCLASS.OnComboClick(CtrlId) GoSub EnableOKButton end event Event OLE_SUBCLASS.OnOptionClick(CtrlId) // Remove name entry from stored list If @USER4 EQ 'DANIEL_ST' then debug end event Event EDL_REC.CHAR(VirtCode, ScanCode, CtrlKey, ShiftKey, AltKey) GoSub EnableOKButton end event Event EDL_SEND.CHAR(VirtCode, ScanCode, CtrlKey, ShiftKey, AltKey) GoSub EnableOKButton end event Event PUB_OK.CLICK() Recipient = Get_Property(@Window:'.EDL_REC', 'TEXT') Sender = Get_Property(@Window:'.EDL_SEND', 'TEXT') // Update APP_INFO list if necessary with new recipient and sender GaNRecSendList = Database_Services('ReadDataRow', 'APP_INFO', 'GAN_REC_SEND_LIST') Recipients = GaNRecSendList<1> Senders = GaNRecSendList<2> UpdateList = False$ Locate Recipient in Recipients using @VM setting vPos else Recipients<0, -1> = Recipient Recipients = SRP_Array('SortSimpleList', Recipients, 'AscendingText', @VM) UpdateList = True$ end Locate Sender in Senders using @VM setting vPos else Senders<0, -1> = Sender Senders = SRP_Array('SortSimpleList', Senders, 'AscendingText', @VM) UpdateList = True$ end If UpdateList then GaNRecSendList = Recipients:@FM:Senders Database_Services('WriteDataRow', 'APP_INFO', 'GAN_REC_SEND_LIST', GaNRecSendList) end Result = Recipient:@FM:Sender End_Dialog(@Window, Result) end event Event PUB_CANCEL.CLICK() Result = False$ End_Dialog(@Window, Result) end event //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Internal GoSubs //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Setup_OLE_Controls: GaNRecSendList = Database_Services('ReadDataRow', 'APP_INFO', 'GAN_REC_SEND_LIST') Recipients = GaNRecSendList<1> Swap @VM with @STM in Recipients Senders = GaNRecSendList<2> Swap @VM with @STM in Senders // Subclass recipient editline to enable it to be a combo box. Ctrl = @Window : '.OLE_SUBCLASS' Send_Message(Ctrl, 'QUALIFY_EVENT', 'OLE.OnOptionClick', 1) Send_Message(Ctrl, 'QUALIFY_EVENT', 'OLE.OnComboClick', 1) EditLine = @Window : '.EDL_REC' Handle = Get_Property(EditLine, 'HANDLE') Send_Message(Ctrl, 'OLE.Subclass', Handle, EditLine) EditLine = @Window : ';EDL_REC' Combo = '' Combo<1> = 1 Combo<2, 1> = '' Combo<2, 2> = 'L' : @STM : 'DYN' Combo<2, 3> = Recipients Combo<2, 4> = 1 Combo<2, 5> = 1 Combo<2, 6> = 0 Combo<2, 9> = 1 Combo<2,10> = 0 Combo<2,11> = 0 Set_Property(Ctrl, 'OLE.Combo[' : EditLine : ']', Combo) // Subclass sender editline to enable it to be a combo box. Ctrl = @Window : '.OLE_SUBCLASS' EditLine = @Window : '.EDL_SEND' Handle = Get_Property(EditLine, 'HANDLE') Send_Message(Ctrl, 'OLE.Subclass', Handle, EditLine) EditLine = @Window : ';EDL_SEND' FilterTypes = 'Sender' Combo = '' Combo<1> = 1 Combo<2, 1> = '' Combo<2, 2> = 'L' : @STM : 'DYN' Combo<2, 3> = Senders Combo<2, 4> = 1 Combo<2, 5> = 1 Combo<2, 6> = 0 Combo<2, 9> = 1 Combo<2,10> = 0 Combo<2,11> = 0 Set_Property(Ctrl, 'OLE.Combo[' : EditLine : ']', Combo) return EnableOKButton: Recipient = Get_Property(@Window:'.EDL_REC', 'TEXT') Sender = Get_Property(@Window:'.EDL_SEND', 'TEXT') BtnEnabled = ( (Recipient NE '') and (Sender NE '') ) Set_Property(@Window:'.PUB_OK', 'ENABLED', BtnEnabled) return