TForm
Source: source/classes/tform.prg
Inherits from: TWindow
TForm is a visual form container that loads its control layout from a .ffm resource (Forms File Memory). It is used by the Visual FiveWin IDE to design and run forms at runtime. The form serializes child controls, their properties, and database bindings.
Key DATA Members
| DATA | Type | Description |
|---|---|---|
nBorderStyle | Numeric | Window border style (default 3 = sizable) |
nPosition | Numeric | Startup position: 0=normal, 1=maximized, 2=minimized |
cDescription | Character | Description visible in the Visual Project manager |
cClassName | Character | Class name used as default resource name for loading .ffm |
oInspector | Object | Property inspector object for design mode |
aProperties | Array | Class DATA array listing all serializable properties |
lDesign | Logical | Enables design mode with drag-and-drop for child controls |
Methods
| Method | Description |
|---|---|
New() | Create a new form with default settings and load .ffm resource |
LoadRes( cResName, cResType ) | Load form definition from a resource (default "FORMS" type) |
ShowModal() | Show the form as a modal dialog, respecting nPosition |
Initiate() | Initialize controls: creates child windows, resolves aliases, sets up database bindings |
Default() | Set default values for border style, position, scrollbars |
Example: Load and Show Form
#include "FiveWin.ch"
function Main()
local oForm := TForm():New()
oForm:cTitle := "My Form"
oForm:nWidth := 600
oForm:nHeight := 400
oForm:nPosition := 0 // normal
oForm:ShowModal()
return nil
Notes
- TForm loads its control layout from a binary .ffm resource stored under the "FORMS" resource type, keyed by the class name.
Initiate()processes database components (TDataBaseComp) before other controls so that aliases are available for TXBrowse and similar controls.- Design mode is toggled via
lDesign, which enables drag-and-drop repositioning of all child controls. - Controls without existing hWnd are created from their stored properties; coordinates are normalized if negative.