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
|
|
|