Re: how to find the TLB of a widget [message #18405] |
Thu, 23 December 1999 00:00 |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
----------
In article <38613EC5.71E5AF2C@cornell.edu>, Jonathan Joseph
<jj21@cornell.edu> wrote:
> Is there a simple way (other than recursively getting the parent)
> to find the Top-level base of a widget. I don't have an event
> structure to query (which stores it as one of it's fields).
>
> It seems that it should be obtainable in one fell swoop using
> widget_info or widget_control, but I can't seem to find
> it if it is there.
>
> Shall I bother to write the routine get_tlb (OK, I've already
> written as it is so trivial) or does such already exist.
>
> -Jonathan
>
>
You don't need recursion... How about (given a widget dw).
repeat begin
tlb=dw
dw=widget_info(dw,/PARENT)
endrep until dw eq 0
JD
|
|
|
Re: how to find the TLB of a widget [message #18415 is a reply to message #18405] |
Wed, 22 December 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Jonathan Joseph (jj21@cornell.edu) writes:
> Is there a simple way (other than recursively getting the parent)
> to find the Top-level base of a widget. I don't have an event
> structure to query (which stores it as one of it's fields).
>
> It seems that it should be obtainable in one fell swoop using
> widget_info or widget_control, but I can't seem to find
> it if it is there.
>
> Shall I bother to write the routine get_tlb (OK, I've already
> written as it is so trivial) or does such already exist.
No event structure!? Weird.
Then why not pass it as a parameter into whatever program
needs the information.
IDL makes it trivially easy to pick out any widget in
a widget hierarchy by using the FIND_BY_UNAME keyword
to WIDGET_INFO. For example, you could define the widget
that carried your info structure (a label widget in this
case) like this:
infoCarrierID = Widget_Label(base, Value='Columns:', $
UName='INFO_CARRIER')
Then find it (usually) in any event handler like this:
infoCarrierID = Widget_Info(event.id, Find_By_UName='INFO_CARRIER')
This is particularly useful in compound widgets, where the
info structure cannot be stored in the top-level base.
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
|
|
|