MdiCascade, MdiTile, MdiIconArrange Methods

Purpose

Arrange the MDI child windows in the MDI parent form.

Syntax

Form.MdiCascade [flag%]

Form.MdiTile [flag%]

Form.MdiIconArrange

Form:Parent MDI Form

Description

To arrange child windows in the cascade format, use the MdiCascade method on the parent form. Typically, the application uses the method when the user clicks Cascade on the Window menu. The optional parameter flag specifies a cascade flag. The only flag currently available, MDITILE_SKIPDISABLED, prevents disabled MDI child windows from being cascaded.

To arrange child windows in the tile format, use the MdiTile method on the parent form. Typically, the application sends this message when the user clicks Tile on the Window menu. The optional parameter specifies a tiling flag. This parameter can be one of the following values:

ValueMeaning

MDITILE_VERTICAL (0) - Tiles MDI child windows so that they are tall rather than wide.

MDITILE_HORIZONTAL (1) - Tiles MDI child windows so that they are wide rather than tall.

MDITILE_SKIPDISABLED (2) - Prevents disabled MDI child windows from being tiled.

The system automatically displays a child window's icon in the lower portion of the client window when the child window is minimized. Use the MdiIconArrange method on the parent form. Typically, the application sends this message when the user clicks Arrange Icons on the Window menu.

Example

ParentW 1

Ocx StatusBar stb

Dim m$(), i%

Array m$() = "File"#10 "New"#10 "-"#10 "Exit"#10#10 _

"Edit"#10#10 "Window"#10 "#1000#Cascade"#10 _

"#1001#&Tile Vertical"#10 "#1002#Tile Horizontal"#10 _

"#1003#Next Window"#10 "#1004#&Previous Window"#10#10 _

"Help"#10 "#1005#About"#10#10

Menu m()

Me.MdiSetMenu 2

For i = 2 To 7

ChildW i, 1

Me.Caption = "MDI Child #" & Format(i)

Next

Do

Sleep

Loop Until Me Is Nothing

 

Sub Win_1_MenuOver(Idx%)

stb.SimpleText = Idx < 0 "" : Dec(Idx)

EndSub

 

Sub Win_1_MenuEvent(Idx%)

Switch Idx

Case 3

If MsgBox("Quit Program?", MB_YESNO) = IDYES _

Win_1.Close

Case 1000 : Win_1.MdiCascade

Case 1001 : Win_1.MdiTile

Case 1002 : Win_1.MdiTile 1

Case 1003 : Win_1.MdiNext

Case 1004 : Win_1.MdiPrev

Case 1005 : MsgBox "GFA-BASIC 32 MDI Demo"

EndSwitch

End Sub

Remarks

An MDI application can arrange its child windows in either a cascade or tile format. When the child windows are cascaded, the windows appear in a stack. The window on the bottom of the stack occupies the upper left corner of the screen, and the remaining windows are offset vertically and horizontally so that the left border and title bar of each child window is visible.

When the child windows are tiled, the system displays each child window in its entirety - overlapping none of the windows. All of the windows are sized, as necessary, to fit within the client window. An MDI application should provide a different icon for each type of child window it supports. The application specifies an icon when registering the child window class.

See Also

Form, ParentW, ChildW, OpenW, MdiSetMenu, MdiNext, MdiPrev, MdiActivate, MdiGetActive

{Created by Sjouke Hamstra; Last updated: 16/10/2014 by James Gaite}