Confusion about IDLgrViewgroup [message #77362] |
Sat, 27 August 2011 08:42  |
Jianbao
Messages: 16 Registered: December 2008
|
Junior Member |
|
|
Hello folks,
I encountered a counterintuitive behavior when I was using IDLgrViewgroup. Here is the code.
<code>
viewgroup = obj_new('IDLgrViewgroup')
xtitle = obj_new('IDLgrText', string = 'x')
viewgroup->add, xtitle
xAxis = obj_new('IDLgrAxis', direction = 0)
xAxis->SetProperty, title = xtitle
</code>
When I ran this piece of code, IDL gave an error message saying that
% IDLGRAXIS::SETPROPERTY: Objects can only have one parent at a time: TITLE
I got this impression from Modern IDL by Michael Galloy that IDLgrViewgroup is useful to contain attribute objects for convenient destruction. But this example shows that if I use an IDLgrText object as an axis title, I have to destroy it explicitly, which seems absolutely dumb. Or am I missing something here?
Thank you very much.
|
|
|
Re: Confusion about IDLgrViewgroup [message #77448 is a reply to message #77362] |
Mon, 29 August 2011 11:23  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
Also, if you are using IDL 8.0 or later, you don't have to worry about
cleaning up at all. I don't necessarily advocate that yet, though, since
you never know who also might want to run your code and what version of
IDL they have.
Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL, A Guide to Learning IDL: http://modernidl.idldev.com
Research Mathematician
Tech-X Corporation
|
|
|