Ignoring child gadgets

BlitzMax Forums/MaxGUI Module/Ignoring child gadgets

col(Posted 2012) [#1]
Hiya all,

The situation I have is that I have a panel that I use as a button gadget. I place text, as a label gadget over the center of that 'fake' button and I want to know when the mouse is over the panel. This is simple enough, but when the mouse moves over the text, the focus moves away from the panel to the label gadget, whereas I still want the focus on the panel.

Is there a way I can ignore the text label when the mouse is over that 'fake' button. Using DisableGadget does the trick but alters the look of the text ( as you'd expect ). I'd like the same effect but keeping the regular text.

I'm sure it's possible and I must be overlooking something in the docs.

Cheeeeers.


Abomination(Posted 2012) [#2]
Perhaps you could do a SetGadgetSensitivity on the label?
Then respond to its events as if they came from the Panel.
(quick and dirty...)
SuperStrict

Import MaxGUI.Drivers

Local  wndMain:TGadget = CreateWindow("SENSITIZEExample",100,100,600,400,Null,WINDOW_RESIZABLE|WINDOW_TITLEBAR|WINDOW_TITLEBAR|WINDOW_CENTER|WINDOW_CLIENTCOORDS|WINDOW_STATUS)
Local  Panel:TGadget = CreatePanel(10,10,200,200,wndMain,PANEL_ACTIVE)
SetPanelColor(Panel,140,170,140)	
Local test:Tgadget=CreateLabel("test",80,80,100,20,Panel)
SetGadgetSensitivity (test,SENSITIZE_MOUSE)
	
Repeat
	WaitEvent()
	SetStatusText wndMain, CurrentEvent.ToString()
	Select EventID()
		Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE;End
	EndSelect
Forever


Last edited 2012


Abomination(Posted 2012) [#3]
Perhaps you could do a SetGadgetSensitivity on the label?
Then respond to its events as if they came from the Panel.
(quick and dirty...)


Last edited 2012


col(Posted 2012) [#4]
Thanks for the example. It works well, but its not my issue.

This issue is specifically something that I'm using for a rollover effect. So i need to have the panel keep the focus even though the mouse is over the label.

In your example you can see the focus moves to the label. I cant get at the label during runtime because its purely for aesthetics.

Hmm.


col(Posted 2012) [#5]
Resolved...

In my main loop, Im using the mouseenter and mouseleave events to call into an object that was set as a gadgetextra for the panel. When needed the object would change the panel graphic to highlight that the mouse is within the panel. Hence the reason for keeping the focus. Moving over the label removed the focus from the panel and the highlighting effect was gone.

To resolve it, in the main loop at the point i would call into the object to change the graphic, i check the eventsource and check its gadget class. If its a label class, i then use the parent of it as the eventsource which then calls the object as before.

Its a bit of a hack and relies on the fact labels have a panel as a parent. In this project that is the case.

Thanks for your suggestion as it did help broaden my thinking.
*thumbs up


Abomination(Posted 2012) [#6]
I don't quite know what you mean by "keeping focus", but You could just ignore the mouse_enter and Mouse_leave events that are produced by the label?
An other sulution might be: drawing the label to the pixmaps You Use as backgrounds for the Panel.
edit>too slow ;)
Nice... <edit

Last edited 2012