Re: Modal widgets and Sending Events [message #21347] |
Sun, 20 August 2000 00:00 |
Ben Tupper
Messages: 186 Registered: August 1999
|
Senior Member |
|
|
David Fanning wrote:
>
> 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?
>
So, when XMANAGER sets things like Widget IDs into common blocks, those are
good for the entire IDL session (as long as Xmanager is managing) rather than
for the particular instance for a call to XMANAGER. I don't know why, but had
I assumed that a common block was a private thing for a single call XMANAGER
(which at this point sounds stupidly like an oxymoron); thus if there are two
calls to XMANAGER I mistakenly believed that there were two common blocks.
I hope that mistaken assumption is forgivable since I have yet to knowingly
use a common block in any code.
Thanks,
Ben
--
Ben Tupper
248 Lower Round Pond Road
POB 106
Bristol, ME 04539
Tel: (207) 563-1048
Email: PemaquidRiver@tidewater.net
|
|
|
Re: Modal widgets and Sending Events [message #21348 is a reply to message #21347] |
Sun, 20 August 2000 00:00  |
Ben Tupper
Messages: 186 Registered: August 1999
|
Senior Member |
|
|
Hello,
The Top and ID values set within the Send_Event structure are those of the
external widget (the calling program, not MYWIDGET).
All other events are generated internally and have MYWIDGET's Top ID value.
So that must be how XMANAGER keeps track of which events are to be block and
which are to be handled.
Ben
Pavel Romashkin wrote:
> What exactly are the Top and ID fields in the event structure? Maybe they
> are those of blocked widget?
> Cheers,
> Pavel
--
Ben Tupper
248 Lower Round Pond Road
POB 106
Bristol, ME 04539
Tel: (207) 563-1048
Email: PemaquidRiver@tidewater.net
|
|
|
Re: Modal widgets and Sending Events [message #21349 is a reply to message #21347] |
Sat, 19 August 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
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
> MYWIDGET.
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?
Cheers,
David
--
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
|
|
|
|