Lost Keyboard Focus

BlitzPlus Forums/BlitzPlus Programming/Lost Keyboard Focus

thalamus(Posted 2005) [#1]
I'm working on a GUI application, but I've noticed that when I click on the various checkboxes, I lose the ability to accept commands via the keyboard.

Is there any way to restore focus to the keyboard at the start of every frame?


CS_TBL(Posted 2005) [#2]
www.blitzbasic.co.nz/Community/posts.php?topic=44780

Use these routines, and you'll have keyboard input *always*!

you need this as well:

.lib "user32.dll"
GetAsyncKeyState%(virtualkeycode%):"GetAsyncKeyState"



Mimi(Posted 2005) [#3]
if you don't want to include the dll-file then try this trick I have found to work:
dummy_window = CreateWindow("",100,100,0,0,0,32): FreeGadget dummy_window

After that code in your program the keyboard will accept input again.
Please give me feed-back, if it works. Thanx.

Mimi


thalamus(Posted 2005) [#4]
I still can't get this to work properly. Surely there's a simple way to restore keyboard focus at the start of a frame...?


kfprimm(Posted 2005) [#5]
ActivateGadget keyboard



thalamus(Posted 2005) [#6]
Did you actually test that before you posted?


thalamus(Posted 2005) [#7]
Aha! The wonderful Mr Sibly actually pointed me in the right direction with this.

Bascially, the trick is to call ActivateGadget after a button or checkbox is manipulated - this will restore Keyboard focus to the gadget you activate (in my case, the main window).