[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing info and destroying widgets...

On 21 Jun 1999 16:25:04 GMT, Struan Gray <struan.gray@sljus.lu.se>

> 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

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

This is the sort of integrated power that can be achieved.