Can I include key press events in my event loop? [message #1739] |
Sat, 19 February 1994 13:52 |
fredrick
Messages: 5 Registered: February 1994
|
Junior Member |
|
|
I'm beginning to learn about IDL and it's widgets and have successfully
created a program with an event loop and different types of widgets (starting
with 'xnothing' as a model.
What I'd like to do is include key-press events in the following event
loop. How can I do it? For example, I might like to just press the "Q"
key to cause my program to quit. Here is the event loop I'm working with
which I mostly lifted from xnothing:
PRO md_control_event, ev
; ************************************************************ ************
; * Event loop for the 'md_control' program. **
; ************************************************************ ************
widget_control, ev.id, get_uvalue=value ; Realize manage & control widgets
if (n_elements(value) eq 0) then value=''
name=strmid(tag_names(ev, /structure_name), 7, 1000)
print,"DEBUG name=",name
case (name) of
"BUTTON": BEGIN
IF (value eq "DONE") then begin
WIDGET_CONTROL, /destroy, ev.top
return
ENDIF
ENDCASE
"TEXT": BEGIN
widget_control, ev.id, get_value=value, set_value=''
END
else:
ENDCASE
Thanks in advance.
--Tim Fredrick (fredrick@acd.ucar.edu)
Ntl Center for Atmospheric Research, Boulder, CO 80307-1000
Systems Administration
|
|
|