Mouse Wheel when over panel

BlitzMax Forums/MaxGUI Module/Mouse Wheel when over panel

Keith Gilbert(Posted 2008) [#1]
Help! I am admittedly a beginner so bear with me please. I have an application with a panel that has a vertical slider on the right and a series of canvases . There is a small gap between the canvases on the panel. When using the mouse wheel over the canvases I receive events. However when the mouse is outside a canvas and over the underlying panel I stop receiving events. I've added an event hook to monitor and see that no events are generated.

Question: How do I implement mouse wheel functionality regardless of where the mouse is located?

Second Question: If it is necessary for me to fill the panel with a canvas to gain the desired functionality is there a problem with laying panels over the top of that canvas? I will be porting to Mac a a later point and believe I've heard that to be an issue?


SebHoll(Posted 2008) [#2]
However when the mouse is outside a canvas and over the underlying panel I stop receiving events.

Did you create the underlying panel with the PANEL_ACTIVE flags? If you have, does clicking inbetween the gap (on the underlying panel) help at all with generating events as this should give the panel focus?

If it is necessary for me to fill the panel with a canvas to gain the desired functionality is there a problem with laying panels over the top of that canvas? I will be porting to Mac a a later point and believe I've heard that to be an issue?

Yep, it is inadvisable to place gadgets over eachother unless the gadget in question is a child to the gadget it is on top of.


SebHoll(Posted 2008) [#3]
Just made a test program to try and replicate what your situation, and it seems as though clicking on the panel fixes the problem...

As such, a possible fix may be to forcibly activate the panel/cavases when the mouse enters them. See code example below:

SuperStrict

Global Window1:TGadget = CreateWindow( "New Window", 200, 200, 400, 300, Null, WINDOW_TITLEBAR|WINDOW_CLIENTCOORDS|WINDOW_STATUS )
	Global Panel1:TGadget = CreatePanel( 0, 0, 400, 300, Window1, PANEL_ACTIVE )
		Global Canvas1:TGadget = CreateCanvas( 0, 0, 195, 300, Panel1, 0 )
		Global Canvas2:TGadget = CreateCanvas( 205, 0, 195, 300, Panel1, 0 )
		

'Panel1
SetGadgetColor( Panel1, 255, 128, 0, True )

Repeat
	
	Select WaitEvent()
		
		Case EVENT_GADGETPAINT
		
			SetGraphics CanvasGraphics(TGadget(EventSource()))
			SetClsColor 0,255,0;Cls;Flip
		
		Case EVENT_MOUSEENTER;ActivateGadget(TGadget(EventSource()))
		
		Case EVENT_WINDOWCLOSE;End

	EndSelect
	
	SetStatusText Window1, CurrentEvent.ToString()
	
Forever
Notice how the canvases are parented to the panel.


Keith Gilbert(Posted 2008) [#4]
Thanks you've given me some direction to move in. I will repost my progress. And yes I do have all underlying gadgets as parent gadgets. I had not used the PANEL_ACTIVE attribute.


Keith Gilbert(Posted 2008) [#5]
Thankyou very much, the PANEL_ACTIVE was my entire issue. Obvious in retrospect looking back at the docs. Sincerely appreciate how quickly you guys assisted!