When running this code it only seem to detect events from the Display 2 window. Uncommenting those 3 lines near the bottom will make it take events from both windows.
Code: Select all
@DISPLAY {Title = "Display 1", X = #LEFT, Y = #TOP}
CreateDisplay(2, {Title = "Display 2", X = 100, Y = 100})
OpenDisplay(2)
Function p_HandlerFunc(msg)
Switch(msg.Action)
Case "OnMouseDown":
Switch(msg.id)
Case 1:
DebugPrint("Display 1 LMB")
Case 2:
DebugPrint("Display 2 LMB")
EndSwitch
Case "OnRightMouseDown":
Switch(msg.id)
Case 1:
DebugPrint("Display 1 RMB")
OpenDisplay(2)
Case 2:
DebugPrint("Display 2 RMB")
CloseDisplay(2)
EndSwitch
Case "CloseWindow":
Switch(msg.id)
Case 1:
Wait(50)
CloseDisplay(1)
End
Case 2:
CloseDisplay(2)
EndSwitch
EndSwitch
EndFunction
InstallEventHandler({OnMouseDown = p_HandlerFunc, OnRightMouseDown = p_HandlerFunc, CloseWindow = p_HandlerFunc})
;SelectDisplay(1)
;InstallEventHandler({OnMouseDown = p_HandlerFunc, OnRightMouseDown = p_HandlerFunc, CloseWindow = p_HandlerFunc})
;SelectDisplay(2)
Repeat
WaitEvent()
Forever