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

Home » Public Forums » archive » Re: Can't set input focus to draw widget
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Can't set input focus to draw widget [message #35169] Thu, 15 May 2003 12:10
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Thu, 15 May 2003 10:47:11 -0700, David Fanning wrote:

> James Rioux (jamesriouxctm@hotmail.com) writes:
>
>> I'm trying to use a draw widget to capture keyboard events in IDL 5.6
>> for Macintosh OS X. The code I have written works fine on a PC but
>> when I move it over to the Macintosh I can't get the draw widget to
>> receive input focus programmatically, even though a text widget on the
>> same base can get focus.
>>
>> Specifically, the follow piece of code works properly:
>> WIDGET_CONTROL, theTextWidget, /INPUT_FOCUS
>> but this piece of code does nothing at all:
>> WIDGET_CONTROL, theDrawWidget, /INPUT_FOCUS
>>
>> The draw widget itself is defined as follows: WIDGET_DRAW(base,
>> XSIZE=512, YSIZE=512, BUTTON_EVENTS=1, KEYBOARD_EVENTS=1, RETAIN=2) so
>> it should be receiving input focus, and indeed, it is on a PC.
>>
>> I can give the draw widget focus by hitting Tab repeatedly, of course,
>> but I'd rather not make the user Tab through all of the controls on the
>> screen every time they want to use the keyboard for something.
>>
>> I am aware of JD's hidden text widget hack, but since I'd like to catch
>> arrow and control keys, I don't believe that will work the way I want
>> it to.
>>
>> Any suggestions or comments? Does Mac OS X not support keyboard input
>> focus for draw widgets?
>
> Wasn't this reported as a bug just a couple of weeks ago!? A couple of
> brain cells seem to be firing, but I can't tell if I am remembering
> something or if the anti-inflamatories are causing hallucinations again.

Yes, I found the same behavior a few weeks back, on all Motif
(i.e. Unix) systems. Here's the answer I got from them:

> You are right ... on all UNIX platforms I tried here, this
> "WIDGET_CONTROL, /INPUT_FOCUS" call is not working as advertised. I
> have entered new report C.R.I.D. #28651 in our bug-tracking
> system. Hopefully, this will be a simple enough issue, so that it
> can be fixed before the final release of the next IDL, due out early
> this summer. Thanks for your persistence, and all your testing.

I was trying to ditch my old keyboard hack too, but this makes
DRAW_KEYBOARD_EVENTS nearly useless. Had I designed keyboard events,
I would have made them a property of *base* widgets, such that any
keypress not trapped by a table, text widget, etc., would generate
such an event. Then, you could attach an event handler to your top
level base and trap anything coming through, or have different panes
of an app use different keymaps. Much more flexible.

I do have an extreme form of the hack which can trap both arrow and
control keys, involving a hidden text widget with more than one line
of text. It's very ugly, and non-crossplatform (but it does work). I
hesitate to release it into the wild, given that this
DRAW_KEYBOARD_EVENTS problem *should* be fixed in the next release.
Email me if you are interested despite these cautionary tales.

JD

P.S. This, and a recent rash of other non-Window's-only bugs, is also
what prompted me to speculate that quality control for Window's IDL
versions is measurably better than for Unix versions.
Re: Can't set input focus to draw widget [message #35206 is a reply to message #35169] Thu, 15 May 2003 10:47 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
James Rioux (jamesriouxctm@hotmail.com) writes:

> I'm trying to use a draw widget to capture keyboard events in IDL 5.6
> for Macintosh OS X. The code I have written works fine on a PC but
> when I move it over to the Macintosh I can't get the draw widget to
> receive input focus programmatically, even though a text widget on the
> same base can get focus.
>
> Specifically, the follow piece of code works properly:
> WIDGET_CONTROL, theTextWidget, /INPUT_FOCUS
> but this piece of code does nothing at all:
> WIDGET_CONTROL, theDrawWidget, /INPUT_FOCUS
>
> The draw widget itself is defined as follows:
> WIDGET_DRAW(base, XSIZE=512, YSIZE=512, BUTTON_EVENTS=1,
> KEYBOARD_EVENTS=1, RETAIN=2)
> so it should be receiving input focus, and indeed, it is on a PC.
>
> I can give the draw widget focus by hitting Tab repeatedly, of course,
> but I'd rather not make the user Tab through all of the controls on
> the screen every time they want to use the keyboard for something.
>
> I am aware of JD's hidden text widget hack, but since I'd like to
> catch arrow and control keys, I don't believe that will work the way I
> want it to.
>
> Any suggestions or comments? Does Mac OS X not support keyboard input
> focus for draw widgets?

Wasn't this reported as a bug just a couple of weeks ago!?
A couple of brain cells seem to be firing, but I can't tell
if I am remembering something or if the anti-inflamatories
are causing hallucinations again. :-(

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Can't set input focus to draw widget
Next Topic: patch update message on idlde

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

Current Time: Fri Oct 10 13:39:17 PDT 2025

Total time taken to generate the page: 0.16283 seconds