[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Object Widgets
- Subject: Re: Object Widgets
- From: "Mark Hadfield" <m.hadfield(at)niwa.cri.nz>
- Date: Wed, 10 Nov 1999 11:38:35 +1300
- Cache-Post-Path: clam-55!unknown@gust.niwa.cri.nz
- Newsgroups: comp.lang.idl-pvwave
- Organization: NIWA
- References: <3823382B.E454DF02@va.aetc.com> <8064k5$kph$1@news.lth.se> <942186229.296290@clam-55>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:17198
More on Struan's widgets. Sorry for thinking aloud on the group but I find
it all quite interesting.
I have thought of a simple (and in hindsight obvious) solution for the heap
cleanup problem for blocking widgets. Just have the Init method for blocking
widgets always return 0. That way the object exists (in some sense) while
the widget application is running but when the widget application exits it
returns to the Init method, which tells IDL that initialisation was not
successful. Sounds dodgy, but seems to work! So the Init method in Struan's
code becomes (additions in capitals):
function SLFow_minimal::init, BLOCK=BLOCK, _ref_extra=extra
if not (self->SLFoWid::init(BLOCK=BLOCK, _extra=extra)) then begin
print, 'SLFow_minimal: failed to initialise SLFoWid'
return, 0
endif
self.myWidID = widget_base(uvalue=self, title=self.title, /column,
xsize=200)
temp = widget_button(self.myWidID, value='Undefined')
self.quitbut = widget_button(self.myWidID, value='Quit')
widget_control, self.myWidID, /realize
self -> xmanage
IF KEYWORD_SET(BLOCK) THEN RETURN, 0 ELSE return, 1
end ; function SLFow_minimal::init
---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield/
National Institute for Water and Atmospheric Research
PO Box 14-901, Wellington, New Zealand