TMDI* (MDI Classes)

Sources: source/classes/mdiframe.prg, mdiclien.prg, mdichild.prg

All three inherit from: TWindow

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

DATATypeDescription
oWndClientObjectThe TMDIClient object that manages child windows
oWndActiveObjectReference to the currently active MDI child window
oMenuObjectMenu object attached to the frame; "Window" submenu is auto-managed
lChildAutoSizeLogicalAuto-maximize new child windows to fill the client area

TMDIClient DATA Members

DATATypeDescription
aWndArrayArray of all TMDIChild windows managed by this client

TMDIChild DATA Members

DATATypeDescription
oWndClientObjectReference to the parent TMDIClient
oControlObjectOptional active control for clipboard/EDIT forwarding

Methods

ClassMethodDescription
TMDIFrameNew( nTop, nLeft, nBottom, nRight, cTitle, nStyle, oMenu, oBrush, oIcon, ... )Create the MDI frame window
TMDIFrameChildNew( ... )Create a new MDI child window
TMDIFrameCascade() / Tile( lHor ) / ArrangeIcons()Arrange child windows
TMDIFrameCloseAll() / CloseActive()Close all or the active child
TMDIFrameNextWindow() / PrevWindow()Cycle through child windows
TMDIFrameZoom()Maximize the active child
TMDIFrameSetMenu( oMenu, nMenuInfo )Set the frame menu with MDI window submenu tracking
TMDIClientNew( oFrame, nSubMenu, nIdChildFirst, oBrush, ... )Create the MDI client window
TMDIClientGetActive()Return the currently active child window (or nil)
TMDIClientChildNew( ... )Create and activate a new MDI child
TMDIClientChildClose( oWnd )Close a specific child window
TMDIClientTile( lHor ) / Cascade() / ArrangeIcons()Arrange child windows within the client
TMDIChildNew( nTop, nLeft, nBottom, nRight, cTitle, nStyle, oMenu, oWnd, ... )Create a new MDI child window
TMDIChildActivate()Show and activate the child window
TMDIChildMaximize() / Restore() / Minimize()Window state management
TMDIChildSetControl( oCtrl )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

See Also