How come this doesn't work?

BlitzMax Forums/BlitzMax Programming/How come this doesn't work?

Russell(Posted 2006) [#1]
win:TGadget = CreateWindow("blah",0,0,320,240,Null)
button:TGadget = CreateButton("Ok",0,0,40,20,win)

Repeat
	WaitEvent()
	
	Select EventID()
		Case EVENT_MOUSEENTER
			Select EventSource()
				Case button
					Print "Mouse entered button area"
			End Select
		Case EVENT_WINDOWCLOSE
			End
	End Select
Forever

Shouldn't "Mouse entered button area" print (on the output 'console' of course) when the mouse enters that area?

Thanks,
Russell


Dreamora(Posted 2006) [#2]
theoretically yes. Practically: Only few gadgets support that event ... I'm not sure if button is one of them (active panels and window are)


Byteemoz(Posted 2006) [#3]
Only canvases and "active" panels can generate mouse-enter-events:
win:TGadget = CreateWindow("blah",0,0,320,240,Null)
panel:TGadget = CreatePanel(0,0,40,20,win,PANEL_ACTIVE) ' needs to be "active"
SetGadgetColor panel , 255 , 255 , 255 ' make it visible

Repeat
	WaitEvent()
	
	Select EventID()
		Case EVENT_MOUSEENTER
			Select EventSource()
				Case panel
					Print "Mouse entered panel area"
			End Select
		Case EVENT_WINDOWCLOSE
			End
	End Select
Forever


-- Byteemoz


Russell(Posted 2006) [#4]
Bummer. This would be a nice event for many gadgets I can think of.

I was going to make my own "tooltips" for buttons, since BMax doesn't seem to have this for some reason (only list-based gadgets?). Oh well, maybe in a future version?

I guess I can just wait for a mouse enter event on a panel, and then get the mouse x/y position within that panel and figure out which button it's over, etc.

Thanks for the replies.

Russell


Russell(Posted 2006) [#5]

I guess I can just wait for a mouse enter event on a panel, and then get the mouse x/y position within that panel and figure out which button it's over, etc.


Unfortunately, if you put buttons on panels then the mouse x and y position can only be had when the mouse is NOT over a button. :(

Seems like a lot of events are not yet supported for some gadgets. And where's the frame gadget? Hopefully, these things will be added to MaxGUI in the near future (after Max3D, of course).

Russell