Creates a MDI Child window within a MDI parent window.
ChildW [options] n, ph [,x, y, w, h, style]
ChildW [options] Owner form, n [,x, y, w, h, style]
ChildW [options] Parent form, n [,x, y, w, h, style]
n, ph, x ,y, w, h, style:integer expression
form:Form object name
options:[Tool] [Center] [Full] [Hidden] [Client3D] [Help] [Top] [Palette] [NoCaption] [NoTitle] [Fixed][Default][MdiChild]
ChildW creates the child window specified in n within the window specified in ph. The upper left corner coordinates of the Child window are given x and y, while the width and the height are given in w and h. The last parameter style is used to configure the window and can take WS_ window style constants. For an overview of the window styles see ParentW.
Alternative ChildW can take a Form object as parent using the syntax Child Owner form or Child Parent form.
ChildW creates a Form object named Win_n, where n is a number between 0 and 31. Although the GFA-BASIC 16 window management commands like MoveW, SizeW, etc. are still present, the window should be managed using the Form properties and methods. In the same tradition messages should be handled using event subs, like Win_1_Activate.
When ChildW specifies a number > 31, then the properties and methods are accessed using Form(n).property and the event sub are like Sub Form_Activate(Index%). The window number is passed as the first argument in the sub parameter list.
The options argument specifies additional window state settings.
Center | centers the form. |
Full | creates a maximized window, excludes Hidden (full windows are always visible). |
Hidden | invisible |
Client3D | set WS_EX_CLIENTEDGE |
Tool | creates a WS_EX_TOOLWINDOW |
Help | includes a Help button in the window caption, excludes minimize an maximize buttons |
Top | creates a topmost window |
Palette | creates a WS_EX_PALETTEWINDOW |
Fixed | a non-sizable window |
NoCaption | no title bar |
NoTitle | no title bar, alias |
Default | uses Windows default values |
Not all options are relevant for a MDI child window.
ParentW 1
Local s% = WS_CAPTION | WS_OVERLAPPED | WS_VISIBLE
ChildW 2, 1, 20, 20, _X / 2, _Y / 2, s%
ChildW 44, 1
ChildW Owner Win_1, 3
Do
Sleep
Until Win_1 Is Nothing
Opens a parent window (1) and within it two child windows (2 and 3). The position and size of the first child window are given while the second window (3) corresponds to the Windows position and size.
In code MDI parent and child windows can also be created using the Form command.
Form MdiParent frmp
Form MdiChild Parent frmp, frmc
Form MdiChild Parent frmp, frmc1
Form MdiChild Parent frmp, frmc2
Form MdiChild Parent frmp, frmc3
//ChildW Owner frmp, 1
//ChildW Parent frmp, # 1
Set Me = frmc
Me.SetFocus
//frmp.MdiTile //Demo
Print frmp.Name
Print frmc.Name
Print "Child? ="; Me.MdiChild
Print "Parent? ="; Me.MdiParent
Print "Parent.Parent? ="; Me.Parent.MdiParent
Print "hMdiClientWnd ="; Me.Parent.hMdiClientWnd
Do
Sleep
Loop Until Me Is Nothing
Form, Iconic?(), Parent(), Visible?(), Zoomed?(), ShowW, ParentW, OpenW, SaveFormPos, LoadFormPos, ModifyStyle, ModifyExStyle, WinDpi, ScaleToDpi, ScaleXYWHToDpi, WM_DPICHANGED.
{Created by Sjouke Hamstra; Last updated: 09/05/2020 by James Gaite}