How can I set the mouse cursor for a specified gadget? I want one of my items to show the 'hand-link' mouse pointer, and I don't see in the docs how to do this.
Mouse on gadget
BlitzMax Forums/BlitzMax GUI Programming/Mouse on gadget SetPointer or something like this...I'm at work I'm not sure
Yes, but SetPointer is global, not gadget-releated. What if I want a button with a hand cursor? I don't even have a mouseenter - mouseleave control to activate and deactivate the hand pointer...
No ideas? noone?
No ideas? noone?
18mins Ziggy... give people a chance!
Tried it with a panel under the button but no good.
Could you save x/y/w/h into an object and check when cursor is in those bounds?
Tried it with a panel under the button but no good.
Could you save x/y/w/h into an object and check when cursor is in those bounds?
Ziggy: You can place a button on a slightly larger active panel to track where the mouse is and by using the EVENT_MOUSEENTER and EVENT_MOUSELEAVE commands, set the pointer when entering a gadget (or more specifically, its surrounding panel).
Have a look at this example:
A bit of a pain, but it's better than nothing.
Seb
Have a look at this example:
Global wndMain:TGadget = CreateWindow("Test Window",100,100,400,300,Null,15) Global gadWindowPanel:TGadget = CreatePanel(0,0,ClientWidth(wndMain),ClientHeight(wndMain),wndMain,PANEL_ACTIVE) Global gadButtonPanel:TGadget = CreatePanel(5,5,110,30,gadWindowPanel,PANEL_ACTIVE) Global gadButton:TGadget = CreateButton("Test Button",5,5,100,20,gadButtonPanel) 'The larger the panel border, the more reliably the pointer will change when mouse moves over it quickly. 'A border of about 5 seems about right for most uses. Repeat Select WaitEvent() Case EVENT_WINDOWCLOSE;End Case EVENT_MOUSEENTER Select EventSource() Case gadWindowPanel;SetPointer(POINTER_NORMAL) Case gadButtonPanel;SetPointer(POINTER_HAND) EndSelect EndSelect Forever
A bit of a pain, but it's better than nothing.
Seb
The proper solution will be for MaxGUI to generate Enter/Leave /etc events on all gadgets... then you can do what you like.
@Brucey: That's exactly the point. Or even han a 'setPointer' directly as a method of a Gadget. Why are there so many system events not being thrown by MaxGui?
Perhaps they never got around to adding them.
I know what you mean though. I wanted the pointer to change to a Hand when I moused over a label (which also changed colour), and then back to a pointer when I moused out (also changing the label colour back), to provide a clickable link.
I know what you mean though. I wanted the pointer to change to a Hand when I moused over a label (which also changed colour), and then back to a pointer when I moused out (also changing the label colour back), to provide a clickable link.
Some of them are never thrown, not?
Quite some of those things work on Windows through tricks in the applications. Z Order modified panels that are created after but shifted behind other gui objects to track mouse data and all those stuff.
Not all of that is a BM problem after all.
The only way to come around it would be a little more actual GUI implementation than the dying WinAPI ... but I don't think we will see a .NET2 / 3 implementation before any pre Vista version of Windows died out
Quite some of those things work on Windows through tricks in the applications. Z Order modified panels that are created after but shifted behind other gui objects to track mouse data and all those stuff.
Not all of that is a BM problem after all.
The only way to come around it would be a little more actual GUI implementation than the dying WinAPI ... but I don't think we will see a .NET2 / 3 implementation before any pre Vista version of Windows died out