Gadget Focus

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by naw.


Hi All,

Anyone know how to determine which Gadget has *Focus*...

I have a small applet with about 20 Text boxes - I'm using drag 'n' dropped files from
Explorer to fill in individual boxes. I'd like to be able to drop the file into the
current text box that has focus...

Alternately, I might try using Mouse X / Y co-ordinates (mmm! nasty) - maybe not.

Ta - N
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

There is GetFocus_() from the WinAPI.


Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> There is GetFocus_() from the WinAPI.

Yes, this will do it; but bear in mind it returns the HANDLE, and not GADGET
NUMBER, of the gadget with the focus. So make sure you create all gadgets
with a handle (eg. sg1_hWnd=StringGadget[...]) or use the GadgetID command
to get the handle of your gadgets.

(PS. Just adding to your tip, Franco -- not implying you didn't know this).


PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.
(PS. Just adding to your tip, Franco -- not implying you didn't know this).

PB - Registered PureBasic Coder



Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by naw.
(PS. Just adding to your tip, Franco -- not implying you didn't know this).

PB - Registered PureBasic Coder



Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.

Hey thanks fellas - I appreciate your response - I didn't know about the GetFocus_() and probably wouldnt have made the connection to using the GadgetID() command to determine the gadget handle without coming across it by accident in the manual.

I'm surprised that GetFocus_() isn't implemented in the standard PB commandset (It would have been documented / X-Platform etc...)

Anyway - thanks again...
Post Reply