From: | Ilkka Lehtoranta |
Date: | 23 Jul 2000 at 00:35:45 |
Subject: | Re: I am going OO nuts !!! |
Hello Colin
On 22-Hei-00, you wrote:
CW> Now that it works, all I have to do now is figure out
CW> HOW it works..... ??
There is some magic out there...
CW> Any pointers (pardon the punn) would be appreciated..
CW>
CW> Q: Where is the function: get() defined & what does it get ??
get() is a shortcut for GetAttr() in the intuition. It is used to
get a variable. Take a look to mui.h
CW> Q: What's the DoMethod() do anyway.... ?
CW> And, what is the "Method" it is doing ??
DoMethod() is like a calling function with more flexiblity, but
technically is totally different.
Every class can handle some methods, for example there are in the
MUI_Window.doc listed all public methods that are implemented by
the window class itself. For example there is MUIM_Window_ToFront
and you can use it to bring you MUI window to front:
DoMethod(winobj,MUIM_Window_ToFront)
You can't really see what DoMethod() does there. But if you create
your own custom class using the window class as the super class you
can overload the MUIM_Window_ToFront method and add your own
features. (It is quite simple.)
----
Ok, let's suppose we have a text object. In the mui.h there is
a complete class tree and looking on it you can see the area class
is the super class of the text class. Therefore you can perform
area methods (and attributes) on your text object. Every unknown
method (or a tag value) is passed to its superclass.
This makes it possible you can use *every single tag or method* on
your object if the class or *any* of its super class knows about it.
For example, you can set the background for every child of the area
class BUT (!!) it is possible that some class derived from the area
class overrides your tag or method. This is class dependant.
Certainly you can't mix features of totally different classes.
I.e. you can use features of the notify class on both window and
area objects since they have same parents. But you can't use area
methods on the window object (this is quite obvious).
Oh, by the way... this is not always obvious, but some methods
can be used only in the custom class code. This includes MUIM_Hide,
MUI_Show, MUIM_Draw and many more. Never ever call custom class
methods yourself. These must be overloaded instead, but it is
another issue...
---
More about MUI... To create a MUI application you need at least
three objects: application object, window object and group objet.
Window objects are attached to the app object, when the group
object is attached to the window object. This group object must
contain all GUI elements for the window (buttons etc.). To control
the layout you can use subgroups and connect everything to the
one main group.
Allan's example contains only one window:
MUIA_Application_Window, win = WindowObject,
Two next lines contains some attributes for this window, and then:
WindowContents, VGroup,
Child, texteditor = TextEditorObject, End,
Child, button = SimpleButton("Clear"),
End, /* VGroup */
This creates a vertical group and two childs on it: the text editor
gadget and a standard button.
Allan used some shortcuts for readability:
---- mui.h ----
#define VGroup MUI_NewObject(MUIC_Group
#define Child MUIA_Group_Child
#define WindowContents MUIA_Window_RootObject
#define SimpleButton(label) MUI_MakeObject(MUIO_Button,label)
---- mui.h ----
Setting up notify statements isn't obvious for beginners and IMO
cut'n'paste is the shortest way. Just try something with the code,
add new buttons, change VGroup to HGroup, try adding a new window
or something. When I started MUI programming I was very confused
but got the idea quickly just trying something own... It is easy!
------------------------------------------------------------------------
It's the End Of The Line for My Shipping Broker.
http://click.egroups.com/1/5175/1/_/451227/_/964305879/
------------------------------------------------------------------------