Please try following code:
Import MaxGUI.Drivers
SuperStrict
Local Window:TGadget = CreateWindow("MOUSEDOWN/UP TEST", 100, 100, 640, 480, Null, WINDOW_TITLEBAR|WINDOW_RESIZABLE)
Local Panel0:TGadget = CreatePanel(64, 64, 64, 64, Window, PANEL_ACTIVE)
SetGadgetColor(Panel0, 255, 0, 0, True)
SetGadgetExtra(Panel0, "Red Panel")
Local Panel1:TGadget = CreatePanel(256, 256, 64, 64, Window, PANEL_ACTIVE)
SetGadgetColor(Panel1, 0, 0, 255, True)
SetGadgetExtra(Panel1, "Blue Panel")
Local Label0:TGadget = CreateLabel("Mouse Down on:", 300, 64, 340, 16, Window)
Local Label1:TGadget = CreateLabel("Mouse Up on:", 300, 80, 340, 16, Window)
While True
WaitEvent
Select EventID()
Case EVENT_WINDOWCLOSE
End
Case EVENT_MOUSEDOWN
SetGadgetText(label0, "Mouse Down on: "+String(GadgetExtra(TGadget(EventSource()))))
Case EVENT_MOUSEUP
SetGadgetText(label1, "Mouse Up on: "+String(GadgetExtra(TGadget(EventSource()))))
End Select
Wend
The do the following, press mouse button down ('mousedown') on one of the panels, then (without releasing it) move (drag) the pointer to the other panel and release it ('mouseup').
In MaxGui 1.39 (on Mac OS X 10.6.4) this behaves correctly, as of MaxGui 1.40/1.41 it does not. EVENT_MOUSEUP source is always the previous EVENT_MOUSEDOWN source, there is no workaround (with events/hooks) without getting truly ugly.
|