Re: How to cleanup an object with a non-modal widget method [message #88082 is a reply to message #88080] |
Wed, 19 March 2014 05:23   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
wlandsman writes:
> Well, one of the methods of the object creates the widget. So I'd say that the object contains the widget, which is why the widget code refers to self when it needs information from the object (e.g. the top level base ID is stored in self.gui ) I don't have any object reference within the widget method which I can destroy except for self. Thanks, --Wayne
I'm thinking something like this:
oAstroMap = obj_new('AstroMap') ;Create the object
oAstroMap.widgetdisplay ;Create the display widget
So, I write the WidgetDisplay method like this:
PRO AstroMap::WidgetDisplay
tlb = Widget_Base(Title='MyWidget',UValue=self, $
Kill_Notify='Widget_Cleanup')
.... ; Doesn't matter what widget I store the object in, $
.... ; just that it have a kill callback associated with it.
END
And, I write Widget_Cleanup like this:
PRO Widget_Cleanup, widget_that_is_dying
Widget_Control, widget_that_is_dying, Get_UValue=myObject
Obj_Destroy, myObject
END
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|