Re: event_pro for compound widgets -- fsc_field issues and handler field [message #40908] |
Thu, 09 September 2004 05:31  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Benjamin Hornberger writes:
> Is there a reason that fsc_field will handle all events internally
> unless event_pro or event_func are specified? Which means, it's not
> possible to have events "bubble up" the hierarchy directly (or is it?).
Oh, it is probably possible. I just have never used
field widgets that would do that, so it never occurred
to me to implement the capability. I prefer dumb fields
that just collect information. When I am interested in
what is in the fields I inquire of them directly, test the
values, etc. Otherwise, the only event I could possibly
imagine being interested in is a Carriage Return. But you
could certainly modify FSC_FIELD to "bubble" events to
the parent.
> I am using fsc_fields in my compound widget and want to have their
> events handled by the CW's base's event handler. It is important that
> event.handler is that base's ID because I store the CW's internal
> variables in the first child's user value (as recommended by the IDL
> help) and I access that in the event handler by
> widget_info(event.handler, /child). If I specify the event handler for
> the fsc_fields directly (using the same function as for the CW's base),
> event.handler will be wrong.
My first thought, if I were trying to work around this, would
be to put the ID of the widget I wanted to find in the FSC_FIELD
user value. Then, in the assigned event handler, I could just look
in the user value of event.id for the "handler" widget.
> Currently, I am working around by specifying an
> event_func='fsc_field_event' for all fsc_fields, which reads
>
> FUNCTION fsc_field_event, event
> return, event
> END
>
> which will make the fsc_fields handle their events externally while
> having the event bubble up the hierarchy (yes, I understood the point
> you were describing above!). That works, but seems a little ugly.
Yes, well if the author was writing for others more than he was
writing for himself, he would probably think more about these issues
in advance. As it is, there are only 24 hours in a day. :-)
>
> Ok, since I have a workaround it's not serious. I was just wondering why
> fsc_field behaves like that.
Laziness, basically. :-)
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http:/www.dfanning.com/
Phone: 970-221-0438, IDL Book Orders: 1-888-461-0155
|
|
|