Re: GUI and non-GUI objects in Catalyst [message #68794 is a reply to message #68769] |
Wed, 02 December 2009 16:00   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Jean-Paul Davis writes:
.
>
> I'm thinking about writing my first Catalyst application, and I'm
> looking for advice from others more experienced with Catalyst on the
> best design approach to handle the following. I will have a
> complicated object (call it "AnObject" for the sake of argument)
> containing data (including other objects) and methods (including read/
> write). I want this object to have a GUI method as an optional way to
> interact with the data in the object, but I do not want to create a
> GUI unless it's needed; i.e., creating an instance of AnObject should
> not by itself automatically create a GUI.
>
> The examples in Catalyst are full "applications" in the sense that the
> application itself is a class derived from a top-level base widget
> class. I could use this application template and simply not call the
> GUI method in order to avoid creating/mapping a GUI, but it seems
> inelegant to use the TLB-widget class as the basis for a non-GUI
> object class. I could make the GUI a separate object that contains an
> AnObject, but that introduces a level of referencing between the
> interaction (GUI) object and the data being manipulated. Or I could
> reverse this so AnObject contains the GUI object if needed, although I
> haven't though through the data referencing implications. Would one
> of these approaches be the most appropriate, or are there other,
> better approaches?
I often build GUI methods for objects that I sometimes, but not always,
want to interact with via a graphical user interface. My NCDF_DATA
object is a good example:
http://www.dfanning.com/programs/ncdf_data__define.pro
I often use that without a GUI interface. But if I need one, I
can just call the BROWSE method on the object. That, in fact,
is exactly what the (extremely!) short NCDF_BROWSER program does:
http://www.dfanning.com/programs/ncdf_browser.pro
I can't think, off-hand, of an instance where I have used the Catalyst
Library to build the GUI as in this example, but I can't think why
it wouldn't work in principle. Catalyst does assume an object
hierarchy, and since it is for building "applications" it pretty
much does assume a GUI of some sort. But I think the widget part of
the library can pretty much stand alone without difficulty.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|