Keyboard-events [message #13138] |
Tue, 20 October 1998 00:00  |
Markku Lappalainen
Messages: 1 Registered: October 1998
|
Junior Member |
|
|
How I can add keyboard-events on my IDL-program?
get_kbrd()-function can be used but that seems to work only if
keyboard-focus is on my IDL-DE. Problem is to receive keyboards button
pressing on my widgets.. I have window with some buttons, sliders, droplists
etc and I need to control my UI also from keyboard so by pressing e.g. key
'b' would have the same same effect as pressing some button from my UI with
mouse.
I have timer-event and I could add get_kbrd(0) function inside it to check
if any buttons has been pressed from keyboard. Now get_kbrd returns always 0
unless I activate my IDL-DE and press it then. Do I need to 'keyboard-focus'
on my widget or what?
Yours, Markku
|
|
|
Re: Keyboard-events [message #13195 is a reply to message #13138] |
Sat, 24 October 1998 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Markku Lappalainen (mtlappa@ee.oulu.fi.no.spam) writes:
> How I can add keyboard-events on my IDL-program?
>
> get_kbrd()-function can be used but that seems to work only if
> keyboard-focus is on my IDL-DE. Problem is to receive keyboards button
> pressing on my widgets.. I have window with some buttons, sliders, droplists
> etc and I need to control my UI also from keyboard so by pressing e.g. key
> 'b' would have the same same effect as pressing some button from my UI with
> mouse.
You are trying to mix apples and oranges here. The proper
way to get user input into a program with a GUI (I.e., a
widget program) is to provide a widget to accept it. In
this case you need a text widget to accept user input.
The IDLDE is a good example of a proper widget program.
It provides a command line to accept user input. Your
programs should use this as an example.
If you are running your program ONLY on Windows machines
you can add keyboard accelerators to Button widgets by
putting the "&" character in front of the letter in the
button value you wish to be the accelerator. For example:
fileID = Widget_Button(tlb, Value='&File')
This will ONLY work on Windows machines.
Cheers,
David
----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|