comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: draw widget + keyboard events
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: draw widget + keyboard events [message #31119 is a reply to message #31089] Wed, 12 June 2002 16:56 Go to previous messageGo to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Fri, 07 Jun 2002 07:53:56 -0700, Ken Mankoff wrote:


> On Fri, 7 Jun 2002, Ken Mankoff wrote:
>> I have a draw widget, and I want to be able to respond to keyboard
>> events in the widget. Is this possible? I see a /MOTION_EVENT and
>> /BUTTON_EVENT flag for the draw widget, but no /KEY_EVENT
>
> OK, nevermind... sorry for not checking google first.
>
> The answer is "no", but you can hack it by hiding a text widget behind
> the draw widget. How to get the location of the mouse at the time of the
> keypress is another issue...
>
>
Well, I always set the input focus in the event callback by doing
something like:

widget_control, self.wHid,/INPUT_FOCUS,set_value=['..','..','..'], $
SET_TEXT_SELECT=self.base_pos

where self.wHid is the hidden text widget. This is done preferrably on
every button click of the draw window (motion events don't change input
focus), incoming WIDGET_TRACKING and all hidden key events. You might
just set_value to '', but I've since developed a refinement to the hack
which allows you to detect arrow keypresses too (although not quite as
reliably as for normal keys), which requires more than one line of text.
I've also had success with certain control key combinations. I think
you'll find all this and more in posts of mine on the topic spread over
the last couple of years.

It's ugly, but it works. I've heard whisperings on the grapevine that a
real cross-platform key event mechanism might make it into some future
version of IDL. I would have voted for that over context menus any day
;).

Good luck,

JD
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: speed up the display on Linux
Next Topic: ION Script & Netscape Server

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 01:52:13 PDT 2025

Total time taken to generate the page: 1.51917 seconds