Re: Window active event? [message #31758] |
Thu, 15 August 2002 08:53 |
bjones8
Messages: 6 Registered: August 2002
|
Junior Member |
|
|
David--
Thanks a ton! It works great! I always wondered what exactly keyboard
focus events were.
BTW
The event structure name is actually WIDGET_KBRD_FOCUS...
Thanks!
-Brandon
David Fanning <david@dfanning.com> wrote in message
> Set the KBRD_FOCUS_EVENT keyword for each base widget.
> When you get a keyboard focus event in your base widget
> event handler, send any event you like to the draw widget.
> It will look something like this:
>
> PRO PROGRAM_TLB_EVENTS, event
> thisEvent = Tag_Names(event, /Structure_Name)
> IF thisEvent EQ 'KBRD_FOCUS_EVENT' THEN BEGIN
> Widget_Control, event.top, Get_UValue=info, /No_Copy
> ; Create some kind of event. Whatever is appropriate.
> ; For example:
> theEvent = {ID:info.drawID, TOP:event.top, HANDLER:0L, TYPE:0}
> Widget_Control, info.drawID, Send_Event=theEvent
> Widget_Control, event.top, Set_UValue=info, /No_Copy
> ENDIF
> ...
> END
>
> Cheers,
>
> David
|
|
|
Re: Window active event? [message #31761 is a reply to message #31758] |
Wed, 14 August 2002 11:11  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Brandon Jones (bjones8@yahoo.com) writes:
> I have a program where I have multiple widget bases each with a draw
> widget inside of it. I want an event to be sent when the individual
> base (window) is made active, or brought to the front.
>
> I know there is the /Viewport_events keyword, but this only sends an
> event when the mouse enters the viewport. I want an event to be sent
> when the window is made active, such as through an Alt-Tab procedure.
Set the KBRD_FOCUS_EVENT keyword for each base widget.
When you get a keyboard focus event in your base widget
event handler, send any event you like to the draw widget.
It will look something like this:
PRO PROGRAM_TLB_EVENTS, event
thisEvent = Tag_Names(event, /Structure_Name)
IF thisEvent EQ 'KBRD_FOCUS_EVENT' THEN BEGIN
Widget_Control, event.top, Get_UValue=info, /No_Copy
; Create some kind of event. Whatever is appropriate.
; For example:
theEvent = {ID:info.drawID, TOP:event.top, HANDLER:0L, TYPE:0}
Widget_Control, info.drawID, Send_Event=theEvent
Widget_Control, event.top, Set_UValue=info, /No_Copy
ENDIF
...
END
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
|
|
|
Re: Window active event? [message #31762 is a reply to message #31761] |
Wed, 14 August 2002 10:58  |
notspecified
Messages: 14 Registered: February 2002
|
Junior Member |
|
|
On 14 Aug 2002 10:33:15 -0700, bjones8@yahoo.com (Brandon Jones)
wrote:
> Hi!
>
> I have a program where I have multiple widget bases each with a draw
> widget inside of it. I want an event to be sent when the individual
> base (window) is made active, or brought to the front.
>
> I know there is the /Viewport_events keyword, but this only sends an
> event when the mouse enters the viewport. I want an event to be sent
> when the window is made active, such as through an Alt-Tab procedure.
>
> Any ideas?
>
Hmm. It seems to me that this is information that you have to ask the
OS for, not IDL. So, how about sending regular timer events to all
your draw windows-- then when the timer event is received, the
receiving draw widget executes the appropriate Win32 function (don't
ask me how-- I have no idea) and finds out from the OS whether it is
the current top window. Ugh.
Matt Feinstein does not include his email address
in the text of usenet postings.
--------
Harvard Law of Automotive Repair: Anything that goes away
by itself will come back by itself.
|
|
|