Sign in Join
FPDoc Onlineexperiment

TForm class

In unit Forms

Implements a form used in an LCL application.

Declaration

pascal
TForm = class(TCustomForm)

Inheritance

  1. TForm
  2. TCustomForm
  3. TCustomDesignControl
  4. TScrollingWinControl
  5. TCustomControl
  6. TWinControl
  7. TControl
  8. TLCLComponent
  9. TComponent

Descends from it: TCalculatorForm TCalendarPopupForm TCustomCopyToClipboardDialog TFindDialogForm TLazarusFileDialogForm TLazMessageDialog TLCLTaskDialog TLoginDialog TReplaceDialogForm TTimePopupForm

Description

TForm is a TCustomForm descendant which implements a form displayed in an LCL application. It sets the visibility and default values for properties introduced in ancestor classes. It also adds methods needed for use as an MDI form in an application. LCL version information is available in the LCLVersion property, and is streamed to to the component resource file when a Parent is not assigned for the form.

Forms created at design-time using the Lazarus IDE are TForm descendants. A form can be used as the main form in an application, or it can be displayed as a MDI forms, dialog box, or tool window. Controls can added to the form, such as: TEdit, TLabel, TButton, TCheckBox, TComboBox, TListView, TTreeView, et. al.

See also

Properties

ClientHandlepublicThe Handle of the MDIForm client (container for MDI children).
DockManagerpublicThe docking layout manager for this control.
ActionpublishedThe Action associated with the control.
ActiveControlpublishedGets or sets the active control on the form.
AlignpublishedSpecifies the placement of the control on its Parent control.
AllowDropFilespublishedSpecifies whether files can be dropped onto this form.
AlphaBlendpublishedAllows the form to be drawn with translucency.
AlphaBlendValuepublishedThe translucence level for the form (0=transparent, 255=opaque).
AnchorspublishedThe set of anchor definitions for this control.
AutoScrollpublishedIndicates if the form can automatically show or hide scroll bars.
AutoSizepublishedAllows automatic adjustment of the size for the control, according to its content.
BiDiModepublishedIndicates whether text controls use in bi-directional reading.
BorderIconspublishedSpecifies the icons which appear in the title bar for the form.
BorderStylepublishedThe border style affects the title bar, border, icon(s), and resize behavior for the form.
BorderWidthpublishedWidth of the Border around the control; default is zero.
CaptionpublishedThe text displayed in the title bar for the form.
ChildSizingpublishedProvides a grid (table) layout for the children of this control.
ClientHeightpublishedThe height for the client area on the control.
ClientWidthpublishedThe width of the client area for the control.
ColorpublishedThe background color for the form.
ConstraintspublishedContains the minimum and maximum Width and Height for the control.
DefaultMonitorpublishedThe monitor on which the form is displayed.
DesignTimePPIpublishedDesign-time Pixels Per Inch for the designer surface.
DockSitepublishedAllows controls to be drag-and-dock-ed into this control.
DoubleBufferedpublishedWhen enabled, it reduces flicker when the control is painted.
DragKindpublishedIndicates the action performed for a drag operation: drag-and-drop or drag-and-dock.
DragModepublishedDetermines how a drag operation is started for the control.
EnabledpublishedDetermines whether the control responds to mouse or keyboard input.
FontpublishedThe font to be used for text display in this control.
FormStylepublishedIndicates the style for the form.
HelpFilepublishedThe name of the help file for the form.
IconpublishedThe Icon associated with this Form (in minimized state).
KeyPreviewpublishedAllows the form to intercept keystrokes in child controls.
MenupublishedThe main menu for the form instance.
ParentBiDiModepublishedIndicates whether the BiDiMode settings in the Parent control are used.
ParentDoubleBufferedpublishedValue for the DoubleBuffered property in a Parent control.
ParentFontpublishedUses the font from the Parent when enabled.
PixelsPerInchpublishedRun-time Pixels Per Inch for the designer surface.
PopupMenupublishedA context-sensitive menu that pops up when the right mouse button is clicked over this control.
PopupModepublishedDefines where pop-up menus are shown.
PopupParentpublishedParent form which owns the current form instance when displayed as a pop-up window.
PositionpublishedThe initial placement for the form.
SessionPropertiespublishedDelimited list of form and / or component properties saved to and restored from an external storage mechanism.
ScreenSnappublishedIndicates whether the form instance can be snapped to an edge on the monitor.
ShowHintpublishedEnables Hint display for the control.
ShowInTaskBarpublishedIndicates if the form should be displayed on the system Task Bar.
SnapBufferpublishedDistance from (or proximity to) an edge on a snap target where the snapping behavior is automatically engaged.
SnapOptionspublishedContains the form and screen snapping options for the form instance.
UseDockManagerpublishedDetermines whether a DockManager is used for this DockSite.
LCLVersionpublishedThe LCL version number as a String type.
ScaledpublishedIndicates if the design surface is scaled to reflect changes in display density (Pixels Per Inch).
TileModepublishedControls the layout order for MDI child forms for a MDI form instance.
VisiblepublishedIndicates if the control is visible on its parent.
WindowStatepublishedIndicates whether the form is displayed in a minimized, maximized, full-screen or normal state.

Methods

WSRegisterClassprotectedCreates an association between the class type and its widgetset class.
CreateWndprotectedCreates the handle for the widgetset class and updates it menu and icons.
LoadedprotectedPerforms actions when LCL component streaming has been completed for the form instance.
CreatepublicConstructor for the class instance.
CascadepublicArranges MDI child forms so they overlap.
NextpublicActivates the next MDI child form (fsMDIChild) in the form sequence.
PreviouspublicActivates the previous MDI child form (fsMDIChild) in the form sequence.
TilepublicArranges MDI child forms using the TileMode for the MDI form.
ArrangeIconspublicArranges the icons for minimized forms in a MDI form.

Events

OnActivatepublishedHandler signalled when the form instance receives focus.
OnChangeBoundspublishedEvent handler signalled when the Bounds for the control have been changed.
OnClickpublishedNotification handler for mouse clicks.
OnClosepublishedHandler called when the form is closed. It determines what happens to the form (destroy, hide, etc.).
OnCloseQuerypublishedEvent handler signalled when trying to close a form.
OnConstrainedResizepublishedThis handler can supply specific Constraints (size limits), when the control is resized.
OnContextPopuppublishedInvoked when a context-sensitive pop-up menu is requested.
OnCreatepublishedHandler called when the form has been created.
OnDblClickpublishedEvent handler signalled when a mouse double click occurs in the control.
OnDeactivatepublishedHandler signalled when the form is deactivated (loses focus).
OnDestroypublishedHandler called when the form is destroyed.
OnDockDroppublishedEvent handler signalled for the drop of a control to be docked.
OnDockOverpublishedEvent handler signalled when a control is moved over a docksite; determines whether the drop event is accepted or rejected.
OnDragDroppublishedEvent handler signalled when an object is dropped onto the control.
OnDragOverpublishedEvent handler signalled when a control is dragged over the control instance.
OnDropFilespublishedHandler called when files have been dropped.
OnEndDockpublishedEvent handler signalled for the end of a drag-dock operation.
OnGetSiteInfopublishedProvides information about the DockSite for the control.
OnHelppublishedHandler called when Help is requested.
OnHidepublishedHandler called when the form is being hidden.
OnKeyDownpublishedEvent handler signalled for key down keyboard events.
OnKeyPresspublishedEvent handler signalled for character data entered by the user.
OnKeyUppublishedEvent handler signalled when a key up event has occurred for the control.
OnMouseDownpublishedEvent handler signalled when a mouse down event is handled for the control.
OnMouseEnterpublishedEvent handler signalled when the mouse pointer has entered the control.
OnMouseLeavepublishedEvent handler signalled when the mouse pointer has left the control.
OnMouseMovepublishedEvent handler signalled when the mouse pointer is moved in the control.
OnMouseUppublishedEvent handler signalled when a mouse up event is handled for the control.
OnMouseWheelpublishedEvent handler for mouse wheel turned.
OnMouseWheelDownpublishedEvent handler signalled for a downward movement of the mouse wheel.
OnMouseWheelUppublishedEvent handler signalled for an upward movement of the mouse wheel.
OnMouseWheelHorzpublishedEvent handler signalled for a horizontal movement of the mouse wheel.
OnMouseWheelLeftpublishedEvent handler signalled for a leftward movement of the mouse wheel.
OnMouseWheelRightpublishedEvent handler signalled for a rightward movement of the mouse wheel.
OnPaintpublishedEvent handler signalled to paint the control.
OnResizepublishedEvent handler signalled when the size for the form is changed.
OnShortCutpublishedEvent handler signalled when a key is pressed, before further handling of the key.
OnShowpublishedHandler called when the form becomes visible.
OnShowHintpublishedEvent handler signalled when a hint window is displayed for the control.
OnStartDockpublishedEvent handler for the start of a docking operation.
OnUnDockpublishedEvent handler signalled before a control is undocked from its DockSite.
OnUTF8KeyPresspublishedHandler for a character entered by the user.
OnWindowStateChangepublishedHandler called when the form is minimized, maximized or restored.

Inherited

From TCustomForm (135)

Activate Active ActiveChanged ActiveDefaultControl ActiveMDIChild AddHandlerClose AddHandlerCreate AddHandlerFirstShow AdjustClientRect AfterConstruction AllAutoSized AutoScale AutoSizeDelayedHandle BeforeDestruction BeginAutoDrag BeginFormUpdate BigIconHandle CalculatePreferredSize CancelControl CanFocus ChildHandlesCreated Close CloseQuery CMActionExecute CMActionUpdate CMActivate CMAppShowBtnGlyphChanged CMAppShowMenuGlyphChanged CMBiDiModeChanged CMDeactivate CMIconChanged CMParentBiDiModeChanged CMRelease CMShowingChanged ColorIsStored ConstrainedResize CreateNew CreateParams Deactivate DefaultControl DefocusControl Designer Destroy DestroyWnd DoAddActionList DoAutoSize Dock DoClose DoCreate DoDestroy DoDock DoExecuteAction DoFirstShow DoHide DoOnChangeBounds DoOnResize DoRemoveActionList DoShow DoShowWindow DoUpdateAction EffectiveShowInTaskBar EndFormUpdate EnsureVisible FocusControl FormIsUpdating FormState GetChildren GetControlClassDefaultSize GetDefaultDockCaption GetFloating GetFormImage GetMDIChildren GetPreferredSize GetRealPopupParent GetRolesForControl HandleCreateException HandleDestroyException HandleShowHideException Hide InitializeWnd IntfDropFiles IntfHelp IsShortcut LastActiveControl MakeFullyVisible MDIChildCount MDIChildren ModalResult Monitor MoveToDefaultPosition Notification OnShowModalFinished PaintWindow ProcessResource Release RemoveAllHandlersOfObject RemoveHandlerClose RemoveHandlerCreate RemoveHandlerFirstShow RequestAlign Resizing RestoredHeight RestoredLeft RestoredTop RestoredWidth SetAutoScroll SetAutoSize SetFocus SetFocusedControl SetParent SetRestoredBounds SetScaled SetVisible SetZOrder Show ShowModal ShowOnTop SmallIconHandle UpdateActions UpdateDockCaption UpdateShowing UpdateWindowState VisibleChanged VisibleChanging VisibleIsStored WantChildKey WMActivate WMCloseQuery WMDPIChanged WMHelp WMShowWindow WMSize WMWindowPosChanged WMWindowPosChanging WndProc

From TCustomDesignControl (2)

AutoAdjustLayout DoAutoAdjustLayout

From TScrollingWinControl (16)

AlignControls AutoScrollEnabled CalculateAutoRanges ClientToScreen ComputeScrollbars GetClientScrollOffset GetLogicalClientRect GetPreferredSizeClientFrame HorzScrollBar ScreenToClient ScrollBy ScrollInView UpdateScrollbars VertScrollBar WMHScroll WMVScroll

From TCustomControl (5)

Canvas FontChanged Paint SetColor WMPaint

From TWinControl (197)

AddControl AutoSizeDelayed AutoSizeDelayedReport AutoSizePhases BeginUpdateBounds BoundsLockCount BroadCast Brush BrushCreated CachedClientHeight CachedClientWidth CanSetFocus CanTab ChangeScale ChildClassAllowed ChildKey ClientRectNeedsInterfaceUpdate CMBorderChanged CMDoubleBufferedChanged CMEnabledChanged CMEnter CMExit CMParentDoubleBufferedChanged CMShowHintChanged CMVisibleChanged CNChar CNKeyDown CNKeyUp CNSysKeyDown CNSysKeyUp ContainsControl ControlAtPos ControlCount ControlKeyDown ControlKeyUp Controls ControlsAligned CreateBrush CreateDockManager CreateHandle CreateParented CreateParentedControl CreateSubClass CustomAlignInsertBefore CustomAlignPosition DefaultHandler DefWndProc DesignerDeleting DestroyHandle DialogChar DisableAlign DoAddDockClient DoAdjustClientRectChange DoAlignChildControls DoAllAutoSize DoChildSizingChange DockClientCount DockClients DockDrop DockOver DoConstraintsChange DoDockClientMsg DoDockOver DoDragMsg DoEnter DoExit DoFlipChildren DoFloatMsg DoGetDockCaption DoKeyDownBeforeInterface DoKeyPress DoKeyUpBeforeInterface DoRemainingKeyDown DoRemainingKeyUp DoRemoveDockClient DoSendBoundsToInterface DoSendShowHideToInterface DoSetBounds DoUnDock DoUndockClientMsg DoUTF8KeyPress EnableAlign EndUpdateBounds EraseBackground FinalizeWnd FindChildControl FindNextControl FixDesignFontsPPIWithChildren FixupTabList FlipChildren Focused FormEndUpdated GetAdjustedLogicalClientRect GetBorderStyle GetChildrenRect GetClientOrigin GetClientRect GetControlIndex GetControlOrigin GetDeviceContext GetDockCaption GetEnumeratorControls GetEnumeratorControlsReverse GetMouseCapture GetParentHandle GetSiteInfo GetTabOrderList GetTextLen GetTopParentHandle Handle HandleAllocated HandleNeeded InsertControl IntfGetDropFilesTarget IntfUTF8KeyPress Invalidate InvalidateBoundsRealized InvalidateClientRectCache InvalidatePreferredChildSizes IsClientHeightStored IsClientWidthStored IsControlMouseMsg IsFlipped IsResizing IsSpecialSubControl KeyDown KeyDownAfterInterface KeyDownBeforeInterface KeyPress KeyUp KeyUpAfterInterface KeyUpBeforeInterface LockRealizeBounds MainWndProc NotifyControls OnAlignInsertBefore OnAlignPosition OnEnter OnExit OnGetDockCaption PaintControls PaintHandler PaintTo ParentFormHandleInitialized ParentHandlesAllocated ParentWindow PerformTab RealGetText ReAlign RealizeBounds RealizeBoundsRecursive RealSetText ReloadDockedControl RemoveControl RemoveFocus Repaint ScaleBy ScaleControls ScrollBy_WS SelectFirst SelectNext SendDialogChar SendMoveSizeMessages SetBorderStyle SetBounds SetChildZPosition SetControlIndex SetDockManager SetShape SetTempCursor ShowControl Showing TabOrder TabStop UnlockRealizeBounds Update UpdateControlState UTF8KeyPress VisibleDockClientCount WindowHandle WMChar WMContextMenu WMDestroy WMEnter WMEraseBkgnd WMExit WMKeyDown WMKeyUp WMKillFocus WMMove WMNotify WMSetFocus WMSysChar WMSysKeyDown WMSysKeyUp WriteLayoutDebugReport WSSetText

From TControl (295)

AccessibleDescription AccessibleName AccessibleRole AccessibleValue ActionChange ActionLink ActiveDefaultControlChanged AddHandler AddHandlerOnBeforeDestruction AddHandlerOnChangeBounds AddHandlerOnEnabledChanged AddHandlerOnEnabledChanging AddHandlerOnKeyDown AddHandlerOnMouseWheel AddHandlerOnResize AddHandlerOnVisibleChanged AddHandlerOnVisibleChanging AdjustSize AnchorAsAlign AnchorClient AnchoredControlCount AnchoredControls AnchorHorizontalCenterTo AnchorParallel AnchorSame AnchorSide AnchorSideBottom AnchorSideChanged AnchorSideLeft AnchorSideRight AnchorSideTop AnchorToCompanion AnchorToNeighbour AnchorVerticalCenterTo AssignTo AutoSizing AutoSizingAll AutoSizingLockCount BaseBounds BaseParentClientSize BeforeDragStart BeginAutoSizing BeginDrag BorderSpacing BoundsChanged BoundsRect BoundsRectForNewParent BringToFront CalculateDockSizes CanAutoSize CaptureChanged CaptureMouseButtons ChangeBounds Changed CheckChildClassAllowed CheckNewParent CheckOnChangeBounds Click ClientOrigin ClientRect ClientToParent CMChanged CMCursorChanged CMHintShow CMHitTest CMMouseEnter CMMouseLeave CMParentColorChanged CMParentFontChanged CMParentShowHintChanged CMSysFontChanged CMTextChanged CNPreferredSizeChanged ControlFontClass ControlOrigin ControlState ControlStyle ControlToScreen CreateAccessibleObject CreateControlBorderSpacing CreateFloatingDockSite Cursor DblClick DefineProperties DesktopFont DisableAutoSizing DoBorderSpacingChange DoCallKeyEventHandler DoCallMouseWheelEventHandler DoCallNotifyHandler Docked DockOrientation DockTrackNoTarget DoContextPopup DoEndDock DoEndDrag DoFixDesignFontPPI DoMouseDown DoMouseUp DoMouseWheel DoMouseWheelDown DoMouseWheelHorz DoMouseWheelLeft DoMouseWheelRight DoMouseWheelUp DoOnParentHandleDestruction DoOnShowHint DoScaleFontPPI DoStartDock DoStartDrag DragCanceled DragCursor DragDrop Dragging DragOver EditingDone EnableAutoSizing EnabledChanged EnabledChanging EndAutoSizing EndDrag ExecuteCancelAction ExecuteDefaultAction FindSubComponent FixDesignFontsPPI Floating FloatingDockSiteClass ForeignAnchorSideChanged GetAccessibleObject GetAction GetActionLinkClass GetAnchorsDependingOnParent GetCachedText GetCanvasScaleFactor GetChildAccessibleObjectAtPos GetColorResolvingParent GetCursor GetDefaultColor GetDefaultHeight GetDefaultWidth GetDockEdge GetDragImages GetEnabled GetFloatingDockSiteClass GetMousePosFromMessage GetPalette GetParentBackground GetParentComponent GetPopupMenu GetRGBColorResolvingParent GetScrolledClientRect GetSelectedChildAccessibleObject GetSidePosition GetTextBuf GetTopParent HandleObjectShouldBeVisible HasHelp HasParent Height HeightIsAnchored HelpContext HelpKeyword HelpType Hint HostDockSite InitiateAction InvalidateControl InvalidatePreferredSize IsAParentAligning IsBorderSpacingInnerBorderStored IsCaptionStored IsControl IsControlVisible IsEnabled IsParentColor IsParentFont IsParentOf IsProcessingPaintMsg IsRightToLeft IsVisible Left LMCaptureChanged LoadedAll LRDockWidth ManualDock ManualFloat MouseCapture MouseDown MouseEnter MouseInClient MouseLeave MouseMove MouseUp OnEditingDone OnEndDrag OnQuadClick OnStartDrag OnTripleClick Parent ParentBackground ParentColor ParentDestroyingHandle ParentFontChanged ParentShowHint ParentToClient Perform PositionDockRect QuadClick ReadBounds ReadState Refresh RemoveHandler RemoveHandlerOnBeforeDestruction RemoveHandlerOnChangeBounds RemoveHandlerOnEnabledChanged RemoveHandlerOnEnabledChanging RemoveHandlerOnKeyDown RemoveHandlerOnMouseWheel RemoveHandlerOnResize RemoveHandlerOnVisibleChanged RemoveHandlerOnVisibleChanging ReplaceDockedControl Resize Scale96ToFont Scale96ToForm Scale96ToScreen ScaleConstraints ScaleDesignToForm ScaleFontsPPI ScaleFontTo96 ScaleFontToScreen ScaleFormTo96 ScaleFormToDesign ScaleScreenTo96 ScaleScreenToFont ScreenToControl SendToBack SetAction SetAlign SetAnchors SetBiDiMode SetBoundsKeepBase SetCursor SetDragMode SetEnabled SetHint SetInitialBounds SetName SetParentBackground SetParentBiDiMode SetParentComponent SetTextBuf ShouldAutoAdjust ShowHelp TBDockHeight Text TextChanged Top TripleClick UndockHeight UndockWidth UpdateAnchorRules UpdateBaseBounds UpdateMouseCursor UpdateRolesForForm UseRightToLeftAlignment UseRightToLeftReading UseRightToLeftScrollBar Width WidthIsAnchored WindowProc WMCancelMode WMLButtonDBLCLK WMLButtonDown WMLButtonQuadCLK WMLButtonTripleCLK WMLButtonUp WMMButtonDBLCLK WMMButtonDown WMMButtonQuadCLK WMMButtonTripleCLK WMMButtonUp WMMouseHWheel WMMouseMove WMMouseWheel WMRButtonDBLCLK WMRButtonDown WMRButtonQuadCLK WMRButtonTripleCLK WMRButtonUp WMXButtonDBLCLK WMXButtonDown WMXButtonQuadCLK WMXButtonTripleCLK WMXButtonUp

From TLCLComponent (6)

DecLCLRefCount GetWSComponentClass IncLCLRefCount LCLRefCount NewInstance WidgetSetClass

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.