> Hello,
>
>  Will somebody give me a hint on how to handle MDI/Client handling, just
> let me know what
> goes where. I know how to handle MDI frame, what I need is where do we
> handle controls,functions and message handlers related to Child window.
>
>  I am new to Fox and C++.
>
> Sudheer.

The FXMDIChild is a child of FXMDIClient.  Inside an FXMDIChild is some
widget like a viewer, which displays some kind of data.  For example,
you could use FXGLViewer inside FXMDIChild.  You can subclass from FXMDIChild
and implement various functions there.

FXMDIClient manages the FXMDIChild windows.  When FXMDIClient receives a 
message, it forwards this to the active FXMDIChild (if there is one).

So, when a button on a toolbar or pulldown menu sends a message, it first
goes to the FXMDIClient.  If the FXMDIClient does not understand it, the
message will be forwarded to the active FXMDIChild.  If the FXMDIChild
does not understand it, then the message should be forwarded to the document
class that FXMDIChild is the view of.

In a nutshell, that's how it should work.  Note that typically, the document
class should embody the data being acted upon.  The document class may keep
track of which FXMDIChild windows refer to it (for example, to know which
FXMDIChild windows need to be repainted when the data inside the document
has been modified!).

Note, MDI applications are a bit tricky, and I do not recommend it as your
first C++ experience, unless perhaps you have prior experience with MDI from
e.g. Windows programming or so (FOX's MDI works very similar).

In FOX, the concept of "message delegation" takes an important role in MDI
applications.  Message delegation is something not all toolkits are capable
off, and therefore many people have not seen it before.

So a short explanation may be in order.  When an object in FOX is sent a 
message, it tries to associate with that message a handler function, which
is a member function of the object that is supposed to respond to the
message.  The associations are made using FXDEFFUNC() in the so-called
message map.

The first message map to search is the one of the object; next, the message
map of the object's base class is tried; and so on until the root object.

If no message is found, the handler onDefault() is called.  The normal
implementation of this member function returns 0, for "message not handled".

However, the onDefault() handler is virtual, and can be overloaded.  By overloading
it, you can therefore delegate the message to another place, after it has been
determined that this object does not understand the message.

This process is called message delegation.  FXMDIClient does delegation by
filtering out a few messages (like ID_MDI_TILEHORIZONTAL) and forwarding
or delegating the remaining messages to the active FXMDIChild.

Eventually, a delegated message is either handled and returns 1 or it is
not handled and returns 0.


Two examples I recommend that you take a look at:- glviewer and mditest; I
think this should give you a good starting point.

Regards,
		Jeroen

