Home »
Public Forums »
archive »
Windows input focus question
Windows input focus question [message #26817] |
Tue, 25 September 2001 17:07 |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
I am writing a dlm to provide improved keyboard, mouse and gameport input
for windows based IDL applications. The mouse and joystick part is pretty
much done, but I have run into a problem getting keyboard input.
The problem is that IDLDE steals the input focus when you hit most keys.
The dlm routine to return the state of individual keys works (I am using
GetAsyncKeyState()) but the IDL application loses focus and the key
character shows up either on the IDLDE command line or in the IDLDE
editor. Forcing focus to the application only causes the application and
IDLDE to battle for focus when keys are pressed flashing the two windows
generally causing a mess.
I guess this really is a windows programming issue: Is there a way to
prevent
IDLDE from taking focus when the user hits a key? It may be impossible
but I would like keyboard focus to be on the IDL application only.
One thought was to write something that would work below IDL and
intercept keys before IDLDE ever sees them but *simple* routines to do
this went out long ago as my modern compiler laughs at me if I try to
include <bios.h>. This wouldn't be optimal anyway since it would pick
up ALL keystrokes.
I have tried unsetting NO_BLOCK on my test application in the hopes that
this would inhibit IDLDE from receiving input at the command line but it
doesn't. You may not be able to execute anything on the command line but
you certainly can fill up the buffer.
I have tried "polling" the keyboard using the IDL_GetKbrd(0) function but
this obtains input from the IDL command line which isn't always available
(for example if IDLDE is minimized) so this approach isn't satisfactory.
Previously I have used the hidden text widget approach to obtain keystrokes
but the whole point of this dlm was to replace this common IDL hack at least
on windows machines.
I am close to giving up on the keyboard input routines but wanted to see if
anyone has had any experience with IDL and the windows API and could
possibly renew my hope that this can be done.
-Rick
|
|
|
Current Time: Fri Oct 10 04:05:20 PDT 2025
Total time taken to generate the page: 0.55734 seconds