
An MDI application usually has a menu item labeled Window that controls
MDI Window menu
the MDI child windows. The Window menu usually has items like Tile,
Cascade, Arrange, and Close All. The name of each open MDI child
window is automatically added to the end of this menu, and the currently
selected window is checked.
MDI child windows have some characteristics of an overlapped window.
MDI child windows
An MDI child window can be maximized to the full size of its MDI client
window or minimized to an icon that sits inside the client window. MDI,
child windows never appear outside their client or frame windows.
Although MDI child windows can’t have menus attached to them, they can
have a TMenuDescr that the frame window uses as a menu when that child
is active. The caption of each MDI child window is often the name of the
file associated with that window; this behavior is optional and under your
control.
ObjectWindows defines classes for each type of MDI window:
MDI in
■ TMDIFrame
ObjectWindows
■ TMDIClient
■ TMDIChild
In ObjectWindows, the MDI frame window owns the MDI client window,
and the MDI client window owns each of the MDI child windows.
TMDIFrame’ member functions manage the frame window and its menu.s
ObjectWindows first passes commands to the focus window and then to its
parent, so the client window can process the frame window’ menus
commands. Because TMDIFrame doesn’t have much specialized behavior,
you’ll rarely have to derive your own MDI frame window class; instead,
just use an instance of TMDIFrame. Since TMDIChild is derived from
TFrameWindow, it can be a frame window with a client window. Therefore,
you can create specialized windows that serve as client windows in a
TMDIChild, or you can create specialized TMDIChild windows. The
preferred style is to use specialized clients with the standard TMDIChild
class. The choice is yours, and depends on your particular application.
Follow these steps to building an MDI application in ObjectWindows:
Building MDI
applications
1. Create an MDI frame window
2. Add behavior to an MDI client window
3. Create MDI child windows
Chapter 6, Window objects
167