Re: Passing info and destroying widgets... [message #15890 is a reply to message #15879] |
Mon, 21 June 1999 00:00   |
Struan Gray
Messages: 178 Registered: December 1995
|
Senior Member |
|
|
Liam.Gumley@ssec.wisc.edu writes:
> If I understand your question correctly, you are trying
> to figure out how to pass a value from a widget event
> manager back to the calling program (i.e. the one that
> invoked XMANAGER) after the top level widget has been
> destroyed. The answer in IDL5 is pointers.
Or objects. Or handles (well *I* like 'em).
I have a number of browser widgets dedicated to a particular
filetypes which I call from other widgets and from the command line.
When they die, their cleanup routine looks to see if the top level
base had a group leader. If it did, and information needs to be
passed upwards, the widget sends a custom event to the group leader
which contains the relevant data. If not, the dying widget pops up a
dialog asking if the user wants to keep the data in memory, and if the
answer is yes, prints out the object/handle/pointer id by which the
data can be globally accessed.
I'm currently playing with a refinement where all my widgets
become objects, and I can invoke certain methods from dying child
widgets, thus bypassing the event queue should I want to force a
particular excecution order. Looks cool.
As a rule I like to put all such code in a cleanup routine rather
than in the event handler. I've been caught out too many times by the
multitude of ways that widgets can be killed other than through an
author-defined 'quit' button - for example, via the window manager,
from XTOOL and when a group-leader dies.
Struan
|
|
|