comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Oddball Event Handling (Longer than it Ought to Be)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Oddball Event Handling (Longer than it Ought to Be) [message #23036 is a reply to message #23035] Sun, 31 December 2000 07:45 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Hi David--

Thanks for the cool description of you project.

Now, prepare to be lightly toasted :-)

> FUNCTION FindTLB, startID
>
> ; This function traces up the widget hierarchy to find the top-level base.
>
> FORWARD_FUNCTION FindTLB
> parent = Widget_Info(startID, /Parent)
> IF parent EQ 0 THEN RETURN, startID ELSE parent = FindTLB(parent)
> RETURN, parent
> END

I have no problem with recursion. In this case however it's not
really needed. For the book larnin' types, this is known as tail
recursion I believe, which is often easily optimized. I admit
recursion may help you conceptualize what's going on though. Wouldn't
the following code do the same thing?

parent = startid
while widget_info(parent, /parent) NE 0 do $
parent = widget_info(parent, /parent)

Craig


--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: lessons learned from ion-script
Next Topic: Catch problem

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 07:27:01 PDT 2025

Total time taken to generate the page: 2.72380 seconds