Skip to content

Instantly share code, notes, and snippets.

@jbratu
Last active August 9, 2017 18:41
Show Gist options
  • Save jbratu/90491a2c1a8fe6d2bbfd to your computer and use it in GitHub Desktop.
Save jbratu/90491a2c1a8fe6d2bbfd to your computer and use it in GitHub Desktop.
OpenInsight contains a commuter module generator to create a shell program capable of handling window events. It doesn't work so well in OpenInsight 9.4 so below is a basic version generated from the commuter module generator that can be easily customized for your window.
Function YOUR_WINDOW_NAME_EVENTS(CtrlEntID,Event,Param1,Param2,Param3,Param4,Param5,Param6,Param7,Param8)
//To use replace YOUR_WINDOW_NAME with your window's form name
*
* Blank Commuter Module
*
Declare Subroutine Msg, FsMsg, Set_Status, Set_Property
Declare Function Msg, Get_Property, Get_Status, Set_Property, Popup
Declare Function Repository, Send_Message, Send_Event, Unassigned, Utility, XLate
Declare Function ContextMenu
$Insert COLORS
$Insert MSG_Equates
$Insert Popup_Equates
$Insert Logical
If Unassigned(CtrlEntID) Then CtrlEntID = ''
If Unassigned(Event) Then Event = ''
If Unassigned(Param1) Then Param1 = ''
If Unassigned(Param2) Then Param2 = ''
If Unassigned(Param3) Then Param3 = ''
If Unassigned(Param4) Then Param4 = ''
If Unassigned(Param5) Then Param5 = ''
If Unassigned(Param6) Then Param6 = ''
If Unassigned(Param7) Then Param7 = ''
If Unassigned(Param8) Then Param8 = ''
*
*
If index(CtrlEntID,".",1) then
WinName = Field(CtrlEntID,'.',1)
Control = Field(CtrlEntID,'.',2)
End else
WinName = CtrlEntID
Control = WinName
End
*
Parent = @window
Frame = Get_Property(Parent,'MDIFRAME')
If len(Frame) then Parent = Frame
*
Retval = 1
*
Begin Case
Case Control = "YOUR_WINDOW_NAME" And Event = 'CREATE'
*Gosub handle create event
Case Control = "BTN_DOSOMETHING"
*Events for CONTROL go here
Begin Case
Case Event = "CLICK"
*Gosub handle click event
End Case
End Case
*
return retval
*
* End Main Routine
*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment