[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Passing info and destroying widgets...
- Subject: Re: Passing info and destroying widgets...
- From: philaldis(at)geocities.com (Phil Aldis)
- Date: Mon, 28 Jun 1999 10:03:47 GMT
- Newsgroups: comp.lang.idl-pvwave
- Organization: Defence Evaluation & Research Agency
- References: <7kkn9k$sag$1@news.doit.wisc.edu> <01bebbf4$60945220$5c0c66a1@eusunw0246.rec.bp.com> <376E5BF5.622A1540@ssec.wisc.edu> <7klp10$o6t$1@news.lth.se>
- Reply-To: philaldis(at)geocities.com
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:15395
On 21 Jun 1999 16:25:04 GMT, Struan Gray <struan.gray@sljus.lu.se>
wrote:
> Interesting discussion snipped
Well while we're all talking about the various styles of widget
programming that we use, I thought I may as well throw my hat into the
ring.
At the moment I'm writing a direct graphics version of IDL's insight.
Those of you who've seen insight will know that there's a data manager
and a visualisation manager. The data manager has to hold all the data
objects and the visualisation mamnager has to hold all the
visualisation objects. It is essential that these two, and the main
program can all communicate.
The only solution is that all the widgets are objects. They are all,
though, very separate entities, and so I make them kind of
compound/object widgets. i.e. I call
datMan = dataManager(PARENT=mainWID)
dataManager then creates its own tlb, and then creates an object of
the class dataManager. Both the visualisation manager and data manager
are subclassed from DERA_Container, which is essentially just like
IDL_Container. They contain all the objects.
The UVALUE of one the menu buttons is set to the object so it can be
got at. I then use the FUNC_GET_VALUE to create a function which when
called returns the object reference. This means that the other object
can then invoke relevenat methods and so on. When an event is
received, the object reference is got, and then an object event
handler is called with teh event passed in. This event handler calls
all the relevant method.
I find this method is by far the best way to create complex widget
programs where lots of different elements interact. The fact that
other objects can call other objects methods is so powerful. For
example, in my main program I have a button which says
'Import file...'
When button is clicked, it simply does:-
Widget_Control, self.datMan, dataObj
dataObj->inportFile
This is the sort of integrated power that can be achieved.
Cheers,
Phil