currently focused gadget

BlitzPlus Forums/BlitzPlus Programming/currently focused gadget

Mr Brine(Posted 2003) [#1]
Alright!

Does anybody know if their is a way to get the currently focused gadget?? or even better does any body know if their is a way to test for either an 'ongadgetfocus' or a 'ongadgetblur' event (my own event names)?? If their isn't and one of the blitz development team are reading, are you planning to add the above events as they would be incredibly useful (espeically for the text field and text area).....go on, you know you wanna!!!!

Ta

Brine


BlitzSupport(Posted 2003) [#2]
See, Mark? Told ya we needed ActiveGadget! :)


Orca(Posted 2003) [#3]
I second that^^


soja(Posted 2003) [#4]
Yeah, how can we implement dialog-style tabbing otherwise? (Is there a way?)


Binary_Moon(Posted 2003) [#5]
I want too.

soja - you would have to use the mouse down event to keep track of the last gadget selected and work out where to go from that. Would be easier if we had the ability to set the tab order of gadget the way you can in VB


soja(Posted 2003) [#6]
...you would have to use the mouse down event to keep track of the last gadget selected ...

But MouseDown only works on canvases, so that wouldn't be feasible.

Similarly, I thought you might be able to wait for a GadgetAction event and then find out what gadget it came from, but apparently a change of focus does not qualify as a GadgetAction.


Binary_Moon(Posted 2003) [#7]
But MouseDown only works on canvases, so that wouldn't be feasible.


Doh :( That makes the project I intended to work on next about a hundred times harder.


soja(Posted 2003) [#8]
Getting the currently focused gadget:

Declaration:
.lib "user32.dll"
GetFocus%():"GetFocus"


Then in your .bb code, just call GetFocus(), which will return either 0 (if your window isn't up front) or the gadget handle that has focus.

NOTE: the Windows gadget handle won't equal the Blitz gadget handle. You must compare it to QueryObject(gadget, 1).

Example:
If GetFocus() = QueryObject(mygadget, 1) Then Notify "MyGadget is selected"



Mr Brine(Posted 2003) [#9]
Nice on man, that bit of info should come in v.helpful!


EOF(Posted 2003) [#10]
Yes. Good one Soja. Thanks.