Re: Keyboard events in a widget [message #14442] |
Thu, 04 March 1999 00:00 |
Ivan Zimine
Messages: 40 Registered: February 1999
|
Member |
|
|
Hi Daniel
You can use ALL_EVENTS keyword to WIDGET_TEXT...
pro test_event, event
EvName=tag_names(event, /structure_name)
case EvName of
'WIDGET_KBRD_FOCUS' : print, "Focus"
'WIDGET_TEXT_SEL' : print, "Selection"
'WIDGET_TEXT_CH' : Print, "Character input"
'WIDGET_TEXT_DEL' : print, "Character deleted"
endcase
end
pro test
w=widget_base( /COLUMN, /KBRD_FOCUS_EVENTS)
item1 = widget_text(w, value='1', /EDITABLE, /ALL_EVENTS)
item2 = widget_text(w, value='2', /EDITABLE,/ALL_EVENTS)
widget_control, /REALIZE, w
xmanager, 'test', w,/JUST_REG
end
Daniel SAGE wrote:
>
> Hi,
> How is it possible to generate an event when the user enters some characters
> in a widget_text or when the focus change of widget_text?
>
> With the small following example, I can catch only the Carriage Return key
> pro test_event, event
> print, event
> end
> pro test
> w=widget_base( /COLUMN, /KBRD_FOCUS_EVENTS)
> item1 = widget_text(w, value='1', /EDITABLE)
> item2 = widget_text(w, value='2', /EDITABLE)
> widget_control, /REALIZE, w
> xmanager, 'test', w,/JUST_REG
> end
>
> ------------------------------------------------------------ ----------------
> Daniel Sage
> EPFL - Swiss Federal Institute of Technology - http://www.epfl.ch
> BIG - Biomedical Imaging Group - http://bigwww.epfl.ch
>
> Address: EPFL, DMT/IOA, BM, CH-1015 Lausanne, Switzerland
> Tel: +41 21 693 5189
> Fax: +41 21 693 3701
> Email: daniel.sage@epfl.ch
> ------------------------------------------------------------ ----------------
--
Ivan Zimine
Dpt. of Radiology (MRI), Geneva University Hospitals
email: ivan.zimine@physics.unige.ch
tel. : (+41 22) 372 70 70
|
|
|
Re: Keyboard events in a widget [message #14444 is a reply to message #14442] |
Thu, 04 March 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Daniel SAGE (daniel.sage@epfl.ch) writes:
> How is it possible to generate an event when the user enters some characters
> in a widget_text or when the focus change of widget_text?
You have to add the ALL_EVENTS keyword to your example:
pro test_event, event
help, event, /Structure
end
pro test
w=widget_base( /COLUMN, /KBRD_FOCUS_EVENTS)
item1 = widget_text(w, value='1', /EDITABLE, /ALL_EVENTS)
item2 = widget_text(w, value='2', /EDITABLE, /ALL_EVENTS)
widget_control, /REALIZE, w
xmanager, 'test', w,/JUST_REG
end
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|