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

Home » Public Forums » archive » How to cleanup an object with a non-modal widget method
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: How to cleanup an object with a non-modal widget method [message #88083 is a reply to message #88082] Wed, 19 March 2014 05:29 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

>
> 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

Of course, in the Cleanup method of the object, you have to be careful
not to use code that works with widgets, without first testing if the
widget is actually there!

PRO AstroMap::Cleanup
IF Widget_Info(self.gui, /Valid_ID) THEN BEGIN
.... ; Widget cleanup stuff here
ENDIF
....
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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: HOW TO COMPUTE BOUNDARY VALUES WHEN YOU HAVE TWO SPIKES IN YOUR DATA
Next Topic: IDL's BESELJ returns NAN for small argument and large order

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

Current Time: Wed Oct 08 19:35:54 PDT 2025

Total time taken to generate the page: 0.00444 seconds