Re: Why IDLgrContainer? [message #12368] |
Thu, 16 July 1998 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Imanol Echave (ccaeccai@sc.ehu.es) writes:
> I've seen in many programs the people creates an IDLgrContainer to destroy the
> objects at the end of the program, but I've done a test and when you destroy an
> IDLgrModel the objects added to this model are destroyed too. Is really
> necessary to create an IDLgrContainer?
Actually, IDLgrContainer has disappeared without a trace in
IDL 5.1. Sorta like those South American desaparecidos.
Nobody's talking. The new guy is IDL_Container. Long live
the king.
In any case, to answer your question, the IDLgrModel appears
to be a subclass of the container class. So yes, things you
add explicitly to the model will be destroyed when the model
is destroyed. What does NOT get destroyed are things that you
create and add to the things that get added to the model.
For example, if I create a font object and add that to an
axis object and add the axis object to the model, then the
model and axis are destroyed when the model is destroyed,
but not the font object.
This behavior is probably in keeping with the idea of object
persistence, but it took me a while to understand it and I
am still overcompensating in programs by adding every damn
thing to my container object. It doesn't appear to do any
harm. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|