The MDI (Multiple Document Interface) system consists of three coordinated classes: TMDIFrame (the main frame window), TMDIClient (the client area that manages child windows), and TMDIChild (individual document child windows). Together they provide the classic Windows MDI experience with tiling, cascading, icon arrangement, and menu merging.
TMDIFrame DATA Members
DATA
Type
Description
oWndClient
Object
The TMDIClient object that manages child windows
oWndActive
Object
Reference to the currently active MDI child window
oMenu
Object
Menu object attached to the frame; "Window" submenu is auto-managed
lChildAutoSize
Logical
Auto-maximize new child windows to fill the client area
TMDIClient DATA Members
DATA
Type
Description
aWnd
Array
Array of all TMDIChild windows managed by this client
TMDIChild DATA Members
DATA
Type
Description
oWndClient
Object
Reference to the parent TMDIClient
oControl
Object
Optional active control for clipboard/EDIT forwarding
Associate an active control (e.g., for clipboard forwarding)
Example: MDI Frame with Two Child Windows
#include "FiveWin.ch"
function Main()
local oWnd, oChild1, oChild2
DEFINE MDIFRAME oWnd TITLE "MDI Demo"
DEFINE MDICHILD oChild1 TITLE "Document 1" OF oWnd
@ 10, 10 SAY "First document" OF oChild1
DEFINE MDICHILD oChild2 TITLE "Document 2" OF oWnd
@ 10, 10 SAY "Second document" OF oChild2
ACTIVATE MDIFRAME oWnd MAXIMIZED
return nil
Notes
Use DEFINE MDIFRAME ... TITLE cTitle to create the frame. The frame automatically creates a TMDIClient and adds a "Window" submenu for child management if none is provided.
Use DEFINE MDICHILD oChild OF oWnd TITLE cTitle to create child windows. They are automatically registered with the TMDIClient via Add().
TMDIFrame forwards clipboard operations (Copy, Cut, Paste, Undo, Redo, Find, SelectAll) to the active child's active control.
Menu merging: when the frame is created with a menu, the nMenuInfo parameter specifies which submenu position becomes the Window list.
The lChildAutoSize flag on TMDIFrame causes new children to open maximized.