[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modal widgets and Sending Events

Ben Tupper (pemaquidriver@tidewater.net) writes:

> I have a widget application (call it MYWIDGET) from which I send events
> to other widgets in the calling routine (via Widget_Control, ExternalID,
> Send_Event = {EVENTSTRUCTURE}).  The procedure is modeled after David's
> xCOLORS procedure.
> I have noticed that when the TLB of MYWIDGET has the MODAL keyword set
> to 1, the events are accumulated until I exit  MYWIDGET.  After exiting,
> these events all come bubbling through to the event handler specified by
> ExternalID.   However, if the MODAL keyword is set to 0, the events are
> sent to the handler as they are generated by the user's actions in

This is exactly what it means to be a modal widget.
Only events in the modal widget are acted upon. All
events in all other widget programs are blocked,
including the events you send from the modal widget
to those other programs. This proves, by the way, that
an event sent via SEND_EVENT is treated exactly as
any other widget event.
> Even though I can control the behavior (so the application does what I
> want it to), this experience exposes one of my numerous widget
> weaknesses: to me, XMANAGER is a black box shrouded by a dense fog in
> the late hours of the night.   So here's the question, how does XMANAGER
> know an event is internal to the MYWIDGET application as opposed to the
> faked events that I send to a widget created outside the widget
> application?

I don't think this is really any great secret.
XManager knows that an event is internal to a program
if the widget that generates the event (event.id) is in the 
widget hierarchy of the top-level base of that program.
(And, of course, you registered the TLB when you called XManager.)
How else would XManager know that you mean *this* XColors
program and not *that* XColors program over there?


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