Form Command

Purpose

Creates a (MDI) form.

Syntax

Form [options] fname [= [title$],[x],[y],[ w, h] ]

Form [options] MdiParent fname [= [title$],[x],[y],[ w, h] ]

Form [options] MdiChild Parent form, fname [= [title$],[x],[y],[ w, h] ]

Form [options] Owner form, fname [= [title$],[x],[y],[ w, h] ]

options: [Tool] [Center] [Full] [Hidden] [Client3D] [Help] [Top] [Palette] [NoCaption] [NoTitle] [Fixed][Default]

fname, form:Form Object variable
title$:sexp, optional
x, y:iexp, optional
w, h:iexp, optional

Description

A Form is a window or dialog box that makes up part of an application's user interface. The Form command creates a Form object with the specified name. The name is used in code to identify the form. The name property must start with a letter and can be a maximum of 40 characters. It can include numbers and underline (_) characters but cannot include punctuation or spaces.

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 opens invisible

Client3D sets 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

The Form command can also be used to create MDI parent and child windows.

Form [options] MdiParent form creates a parent MDI window (like ParentW).

Form [options] MdiChild Parent form, name creates a MDI child window name of MDI parent form (like ChildW).

Form MdiParent test  = , , 20 , 300 , 300

Form MdiChild Parent test, ch2

Form Hidden MdiChild Parent test, ch1 = "ChildW ch1", , , 10, 10

An Ocx Form is a control with all the attributes of a Form. An Ocx Form is used as a child form inside a parent form. Ocx Form is equivalent to VB's PictureBox.

Example

Form ftest = "Test Form", , , 300, 300

// to create a form

Local a%

Print "GFA-BASIC 32"

Print

Print "Press any key"

KeyGet a%

ftest.Close

//or

Form ftest = "GFA", 10, 10, 200, 300

// center it in the middle of the desktop

ftest.Center 0

// OpenW 1, 10, 10, 300, 400

// if used for a windows with it's handle

// Win_1.hWnd

// test.Center Win_1.hWnd

Print "Press any key"

KeyGet a%

ftest.Close

Remarks

OpenW #n, ChildW #n, and ParentW #n are commands that create a Form, whose name is predestined by GFA-BASIC 32. These commands take a number n in the range from 0 to 31 to be identified by. These commands get the Form name Win_n, where n is the window number (Win_0 .. Win_31). A value greater than 31 will provide the window with the Form object name Form(n).

The same is true for the Dialog command, which takes a number from 0 to 31 as well. The Form object for the dialog boxes is Dlg_0 .. Dlg_31.

For an example of ParentW, ChildW, and Ocx Form see ParentW.

See Also

Form Object, OpenW, ChildW, ParentW, Dialog, SaveFormPos, LoadFormPos, ModifyStyle, ModifyExStyle, WinDpi, ScaleToDpi, ScaleXYWHToDpi, WM_DPICHANGED.

{Created by Sjouke Hamstra; Last updated: 17/12/2021 by James Gaite; Other Contributors: Jean-Marie Melanson}