Select EventSource() for Panels ?
BlitzMax Forums/MaxGUI Module/Select EventSource() for Panels ?
| ||
I'm trying to detect wether the mouse is over two panels. I have another way more complex way of trying to do it that I believe will work. But I was wondering why the current way i'm trying to do it doesn't work. It's a little hard to adjust to blitz max b/c there's no examples using the commands I want to use (like blitz 3d). The code runs but it doesn't do what I want it to do. if u think you know how to do it, please let me know! thanks. By the way, does anyone know where I can find a bunch of examples using the most important and useful blitz GUI functions (besides on this website) ? the code is right here... Global MyWindow:TGadget=CreateWindow("My Window", 0,0,800,600) Global Panel_1:TGadget=CreatePanel(200,100,100,50, MyWindow, 10, "Panel 1") SetpanelColor(Panel_1, 255,0,0) Global Panel_2:TGadget=CreatePanel(500,100,100,50, MyWindow, 10, "Panel 2") SetpanelColor(Panel_2, 0,255,0) Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End Case EVENT_GADGETACTION '---------------------------------- Select EventSource() Case Panel_1 Select EventID() Case EVENT_MOUSEENTER,EVENT_MOUSEUP 'Print("its on") SetStatusText MyWindow,"Over Panel 1" End Select Case Panel_2 Select EventID() Case EVENT_MOUSEENTER,EVENT_MOUSEUP 'Print("its on") SetStatusText MyWindow,"Over Panel 2" End Select End Select 'eventSource '----------------------------------- End Select 'event_gadgetaction Forever |
| ||
Here's your example with a lot less Select/Case statments...Global MyWindow:TGadget=CreateWindow("My Window", 0,0,800,600) Global Panel_1:TGadget=CreatePanel(200,100,100,50, MyWindow, PANEL_ACTIVE | PANEL_GROUP, "Panel 1" ) SetPanelColor(Panel_1, 255,0,0) Global Panel_2:TGadget=CreatePanel(500,100,100,50, MyWindow, PANEL_ACTIVE | PANEL_GROUP, "Panel 2" ) SetPanelColor(Panel_2, 0,255,0) Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End End Select '---------------------------------- Select EventSource() Case Panel_1 Select EventID() Case EVENT_MOUSEENTER SetStatusText MyWindow,"Over Panel 1" End Select Case Panel_2 Select EventID() Case EVENT_MOUSEENTER SetStatusText MyWindow,"Over Panel 2" End Select End Select 'eventSource '----------------------------------- Forever btw... you can use {code} {/code} or {codebox} {/codebox} for your source - replace curly brackets with SQUARE brackets ;-) |
| ||
Thanks Brucey, that was very helpful |
| ||
I have the same probleme under MacOS X! Can anybody help! I have 2 Graphics panel then i print out the currentevent it shows me only the mousebutton state and the x and y coordinate this is all. |
| ||
You need to check the context via EventSource() or event.source (as shown in the code above). |
| ||
OK, i have it, the source will work. |