Lost Keyboard Focus
BlitzPlus Forums/BlitzPlus Programming/Lost Keyboard Focus| 
 | ||
| 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? | 
| 
 | ||
| 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" | 
| 
 | ||
| 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_windowAfter that code in your program the keyboard will accept input again. Please give me feed-back, if it works. Thanx. Mimi | 
| 
 | ||
| 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...? | 
| 
 | ||
| ActivateGadget keyboard | 
| 
 | ||
| Did you actually test that before you posted? | 
| 
 | ||
| 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). |