EVENT_MOUSEUP awkward behavior

Archives Forums/MaxGUI Bug Reports/EVENT_MOUSEUP awkward behavior

overmeeren(Posted 2010) [#1]
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.


skidracer(Posted 2010) [#2]
If Seb or SKN3? is available hopefully he can look at this, I would assume it has to do with this comment in the changelog of cocoamaxgui :

ModuleInfo "History: 1.51 Release"
ModuleInfo "History: skn3[ac]'s canvas EVENT_MOUSEUP firing fix."


Last edited 2010


SebHoll(Posted 2010) [#3]
I'm pretty sure this is the same as what happens on Windows and Linux, which it is why it is implemented as such. An EVENT_MOUSEUP which is fired after a mouse is moved with a button down, is effectively being an EVENT_DRAGRELEASE if one were to exist.

Admittedly, in some situations it's rather awkward but in others, this behavior is what you want.

Last edited 2010