[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Controls' (#lcl)

TWinControl

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

The base class for controls which can contain other (child) controls.

Declaration

Source position: controls.pp line 1929

type TWinControl = class(TControl) end;

protected

  FWinControlFlags: TWinControlFlags;

  

Various control state flags.

  class procedure WSRegisterClass; override;

  

Registers this component class with the current WidgetSet.

  procedure AdjustClientRect(); virtual;

  

Override this method when the ClientRect of a control differs from the default value.

  procedure GetAdjustedLogicalClientRect();

  

Returns the adjusted ClientRect, cached value if available.

  procedure CreateControlAlignList();

  

Fills the list with the controls which must be realigned.

  procedure AlignControls(); virtual;

  

Aligns all child controls.

  function CustomAlignInsertBefore(); virtual;

  

Returns the placement order of custom-aligned child controls, using the OnAlignInsertBefore handler.

  procedure CustomAlignPosition(); virtual;

  

Returns the aligned position of a custom-aligned child control, using the OnAlignPosition handler.

  function DoAlignChildControls(); virtual;

  

Override this method to place all given controls.

  procedure DoChildSizingChange(); virtual;

  

Call this after a change in the ChildSizing information, to trigger further processing.

  procedure InvalidatePreferredChildSizes;

  

Flags the preferred sizes of all child controls as invalid (recursively).

  function CanTab; override;

  

If True, the Tab key can be used to navigate to this control.

  function IsClientHeightStored; override;

  function IsClientWidthStored; override;

  procedure DoSendShowHideToInterface; virtual;

  

Sends the new Visible state to the widgetset.

  procedure ControlsAligned; virtual;

  

Called by AlignControls after aligning controls.

  procedure DoSendBoundsToInterface; virtual;

  

Sends the control's new bounds to the widget.

  procedure RealizeBounds; virtual;

  

Checks for BoundsRect changes and sends changed bounds to the widget, using DoSendBoundsToInterface.

  procedure RealizeBoundsRecursive;

  

Sends eventually changed BoundsRects to the widgets, for this and all child controls.

  procedure InvalidateBoundsRealized;

  procedure CreateSubClass();

  

TODO: Check if we need this method

  procedure DoConstraintsChange(); override;

  procedure DoSetBounds(); override;

  

Updates the size and extent of the control and ClientRect.

  procedure DoAutoSize; override;

  

Shrink or enlarge the control to fit children.

  procedure DoAllAutoSize; override;

  procedure AllAutoSized; virtual;

  

Called by DoAllAutoSize after all bounds are computed.

  procedure CalculatePreferredSize(); override;

  

Override this method to return a different preferred height and width for autosizing.

  procedure GetPreferredSizeClientFrame(); virtual;

  procedure GetChildren(); override;

  

Calls Proc with every child control, owned by Root.

  function ChildClassAllowed(); override;

  

Returns True if the given class is allowed for child controls.

  procedure PaintControls();

  

Paint all child controls which don't have a Handle.

  procedure PaintHandler();

  

Handler for TLMPaint, manages the painting of child controls.

  procedure PaintWindow(); virtual;

  

Paints an clipped part (child control) of the DC.

  procedure CreateBrush; virtual;

  

Creates the Brush, if not already created.

  procedure ScaleControls(); virtual;

  

Scales (resizes) all child controls.

  procedure ChangeScale(); override;

  

Scales (resizes) the control and all child controls.

  procedure CMBiDiModeChanged(); message;

  

Handler for changed BiDiMode message. Notifies the widget and all child controls.

  procedure CMBorderChanged(); message;

  

Handler for changed Border properties message. Adjusts and invalidates the control.

  procedure CMEnabledChanged(); message;

  

Handler for changed Enabled message. Notifies the widgetset.

  procedure CMShowingChanged(); message;

  

Handler for changed Showing message. Notifies the widgetset.

  procedure CMShowHintChanged(); message;

  

Handler for changed ShowHint message. Notifies all child controls.

  procedure CMVisibleChanged(); message;

  

Handler for changed Visible message. Handles Focus, forces UpdateControlState.

  procedure CMEnter(); message;

  

  procedure CMExit(); message;

  

  procedure WMContextMenu(); message;

  

Handler for an ContextMenu event. Eventually delegates handling to the affected child control.

  procedure WMEraseBkgnd(); message;

  

Erases the background, if required.

  procedure WMNotify(); message;

  

Handles (dispatches) notification messages.

  procedure WMSetFocus(); message;

  

Handler for receiving Focus event.

  procedure WMKillFocus(); message;

  

Handler for loosing Focus event. Eventually triggers #lcl.Controls.TControl.EditingDone.

  procedure WMShowWindow(); message;

  

Handler for changed visibility notification

  procedure WMEnter(); message;

  

  procedure WMExit(); message;

  

  procedure WMKeyDown(); message;

  

Event handler for key pressed, not handled by the widget. Tries TWinControl.DoRemainingKeyDown.

  procedure WMSysKeyDown(); message;

  

Event handler for sys key pressed, not handled by the widget. Tries TWinControl.DoRemainingKeyDown.

  procedure WMKeyUp(); message;

  

Event handler for key released, not handled by the widget. Tries TWinControl.DoRemainingKeyUp.

  procedure WMSysKeyUp(); message;

  

Event handler for system key released, not handled by the widget. Tries TWinControl.DoRemainingKeyUp.

  procedure WMChar(); message;

  

Handler for message sent by the widget, after it has handled the keypress itself.

  procedure WMSysChar(); message;

  

Handler for message sent by the widget, after it has handled the keypress itself.

  procedure WMPaint(); message;

  

Manages paint requests, handles double buffering.

  procedure WMDestroy(); message;

  

Handler for widget destroyed message. Clears the Handle.

  procedure WMMove(); message;

  

Handler for widget moved message. Updates the Bounds.

  procedure WMSize(); message;

  

Event handler for size messages.

  procedure WMWindowPosChanged(); message;

  

Event handler for size/move messages.

  procedure CNKeyDown(); message;

  

Handler for a key pushed notification. The message is handled by DoKeyDownBeforeInterface by default.

  procedure CNSysKeyDown(); message;

  

Handler for a system key pushed notification. The message is handled by DoKeyDownBeforeInterface by default.

  procedure CNKeyUp(); message;

  

Handler for a key released notification. The message is handled by DoKeyUpBeforeInterface by default.

  procedure CNSysKeyUp(); message;

  

Handler for a system key released notification. The message is handled by DoKeyUpBeforeInterface by default.

  procedure CNChar(); message;

  

Handler for a key pressed notification. CNChar is sent by the widget before it has handled the keypress itself.

  function DoDragMsg(); override;

  

Dispatches a drag message, sent by the DragManager.

  function DoDockClientMsg(); virtual;

  

Handles a dmDragDock message, when a control has been docked to this site.

  function DoUndockClientMsg(); virtual;

  

Notifies the DockManager of the undock of a client control.

  procedure DoAddDockClient(); virtual;

  

Adjust the Parent of a newly docked Client.

  procedure DockOver(); virtual;

  

Called to check whether this control allows docking and where.

  procedure DoDockOver(); virtual;

  

Invoke the OnDockOver handler.

  procedure DoRemoveDockClient(); virtual;

  

Override this method to take special actions on removal of an docked client.

  function DoUnDock(); virtual;

  

Notifies an OnUnDock handler and DockManager of an undocked client control.

  procedure GetSiteInfo(); virtual;

  

Return information about this dock site (InfluenceRect).

  function GetParentHandle;

  function GetTopParentHandle;

  procedure ReloadDockedControl(); virtual;

  

Returns the docked control of the specified name.

  function CreateDockManager; virtual;

  

Returns the DockManager for this control.

  procedure SetDockManager();

  procedure DoFloatMsg(); override;

  

Handler called when the control starts floating.

  procedure DoGetDockCaption(); virtual;

  

Returns the dock caption of AControl.

  procedure DoEnter; virtual;

  

Invokes the OnEnter event handler.

  procedure DoExit; virtual;

  

Invoke the OnExit event handler.

  function DoKeyDownBeforeInterface();

  

Handles a KeyDown event before the widget processes the key.

  function DoRemainingKeyDown();

  

Handles keys which are not handled by the widget.

  function DoRemainingKeyUp();

  

  function DoKeyPress();

  

Tries all OnKeyPress handlers, of Parents first.

  function DoUTF8KeyPress(); virtual;

  function DoKeyUpBeforeInterface();

  

Handles a KeyUp event before the widget processes the key.

  function ChildKey(); virtual;

  

  function SendDialogChar();

  

  function DialogChar(); override;

  

Do something useful with accelerators etc.

  procedure ControlKeyDown(); virtual;

  

Lets the Application handle an navigation key.

  procedure ControlKeyUp(); virtual;

  

Lets the Application handle an navigation key.

  procedure KeyDown(); virtual;

  

Invokes the OnKeyDown handler.

  procedure KeyDownBeforeInterface(); virtual;

  

Invokes the OnKeyDown handler.

  procedure KeyDownAfterInterface(); virtual;

  

  procedure KeyPress(); virtual;

  

Invokes the OnKeyPress handler.

  procedure KeyUp(); virtual;

  

Invokes the OnKeyUp handler.

  procedure KeyUpBeforeInterface(); virtual;

  

Invokes the OnKeyUp handler.

  procedure KeyUpAfterInterface(); virtual;

  

  procedure UTF8KeyPress(); virtual;

  

Invokes the OnUTF8KeyPress handler.

  function FindNextControl();

  

Returns the preceding or next control in tab order.

  procedure SelectFirst;

  

Returns the first control in tab order.

  function RealGetText; override;

  

Returns the Caption property.

  function GetBorderStyle;

  function GetClientOrigin; override;

  function GetClientRect; override;

  function GetControlOrigin; override;

  

Returns the origin (top left pixel) of the control, in screen coordinates.

  function GetDeviceContext(); override;

  

Returns a device context handle for the control, from Parent.

  function IsControlMouseMsg();

  

Sends the mouse message to a child control.

  procedure CreateHandle; virtual;

  

Creates the Handle ( = widget) if not already done.

  procedure CreateParams(); virtual;

  

Initializes the window creation parameter record with the settings of the control.

  procedure CreateWnd; virtual;

  

Creates the interface object (widget) and assigns it to Handle.

  procedure DestroyHandle; virtual;

  

Destroys this and all child widgets.

  procedure DestroyWnd; virtual;

  

Destroys the interface object (widget).

  procedure DoFlipChildren; virtual;

  

Flip children horizontally. That means mirroring the Left position.

  procedure FinalizeWnd; virtual;

  

Prepare to remove the window (gets called before the Handle is destroyed).

  procedure FixupTabList;

  

Assigns strictly sequential TabOrder values to all child windows.

  procedure FontChanged(); override;

  

Handles changes of the Font property.

  procedure InitializeWnd; virtual;

  

Copies cached control properties to the just created widget.

  procedure Loaded; override;

  

Called when the control has been loaded from a resource, transfers the loaded property values to the widget.

  procedure FormEndUpdated; override;

  

Realizes all cached changes after a bulk update of the form. Calls inherited FormEndUpdated, then informs each child control.

  procedure MainWndProc();

  

This method allows handling messages in Windows

  procedure ParentFormHandleInitialized; override;

  

Called after all children handles of the ParentForm are created. Notifies all children of the end of the handle creation phase.

  procedure ChildHandlesCreated; virtual;

  

Called after all child handles have been created. Resets wcfCreatingChildHandles.

  function GetMouseCapture; override;

  procedure RealSetText(); override;

  

Sets the Caption property.

  procedure RemoveFocus();

  

Notifies the parent form of the focus loss.

  procedure SendMoveSizeMessages(); override;

  

Sends Move and Size messages through the LCL message paths.

  procedure SetBorderStyle(); virtual;

  procedure SetColor(); override;

  procedure SetChildZPosition();

  

Updates the position of the child control in the Z plane (ie front-to-back).

  procedure ShowControl(); virtual;

  

Asks the parent to show ourself.

  procedure UpdateControlState;

  

Essentially updates the visible state of the control, and of the widget if already created.

  procedure UpdateShowing; virtual;

  

When the widget should be visible and has not yet been created, it's created along with all children.

  procedure WndProc(); override;

  

Adds special handling for focus and input messages, notifies an DockManager.

  procedure WSSetText(); virtual;

  

Sends text to the widget (from WM_SETTEXT?).

  property WindowHandle: HWND; [rw]

  

For internal use: allows direct access to Handle, bypassing any getter/setter methods.

  property BorderStyle: TBorderStyle; [rw]

  

Allows to show a border (line) around the control,

  property OnGetSiteInfo: TGetSiteInfoEvent; [rw]

  

Provides information about the DockSite.

  property OnGetDockCaption: TGetDockCaptionEvent; [rw]

  

This handler can provide a special DockCaption, different from the Caption default.

public

  property BorderWidth: TBorderWidth; [rw]

  

Width of the Border around the control; default is zero.

  property BoundsLockCount: Integer; [r]

  

For internal use: When greater zero, updates of the BoundsRect are blocked.

  property Brush: TBrush; [r]

  

The Brush used to paint the background of the control.

  property CachedClientHeight: Integer; [r]

  

The intended ClientHeight, as sent to the widget.

  property CachedClientWidth: Integer; [r]

  

The intended ClientWidth, as sent to the widget.

  property ChildSizing: TControlChildSizing; [rw]

  

Parameters for child control arrangement and spacing.

  property ControlCount: Integer; [r]

  

The number of immediate child controls.

  property Controls []: TControl; [r]

  

The indexed list of immediate child controls.

  property DefWndProc: Pointer; [rw]

  

The default WndProc on Windows widgetset and platforms.

  property DockClientCount: Integer; [r]

  

The number of clients docked into this control.

  property DockClients []: TControl; [r]

  

The indexed list of controls docked into this control.

  property DockManager: TDockManager; [rw]

  

The docking layout manager for this control.

  property DockSite: Boolean; [rw]

  

Allows to drag-dock other controls into this control.

  property DoubleBuffered: Boolean; [rw]

  

Allows to reduce flicker in the painting of the control.

  property Handle: HWND; [rw]

  

A reference to the widget, associated with this control.

  property IsResizing: Boolean; [r]

  

Check IsResizing and drop or delay changes to the control, until the new size has been determined.

  property TabOrder: TTabOrder; [rw]

  

Determines the sequence of controls, reachable when the user presses the Tab key.

  property TabStop: Boolean; [rw]

  

Allows the user to navigate to this control, by pressing the Tab key.

  property OnAlignInsertBefore: TAlignInsertBeforeEvent; [rw]

  

Handler for custom-aligned child controls, determines the order of control placement.

  property OnAlignPosition: TAlignPositionEvent; [rw]

  

Handler for custom-aligned child controls, determines the position of the child control.

  property OnDockDrop: TDockDropEvent; [rw]

  

Notification handler for the drop of a control to be docked.

  property OnDockOver: TDockOverEvent; [rw]

  

Event handler for moves of a control over this docksite. Determines acceptance or rejection of an possible drop.

  property OnEnter: TNotifyEvent; [rw]

  

Handler for control receiving the focus.

  property OnExit: TNotifyEvent; [rw]

  

Handler for control loosing the focus. This is a good place for checking the finished user input.

  property OnKeyDown: TKeyEvent; [rw]

  

Handler for keyboard key pressed.

  property OnKeyPress: TKeyPressEvent; [rw]

  

Handler for a character entered by the user.

  property OnKeyUp: TKeyEvent; [rw]

  

Handler for keyboard key released.

  property OnUnDock: TUnDockEvent; [rw]

  

Event handler for control being undocked from this DockSite.

  property OnUTF8KeyPress: TUTF8KeyPressEvent; [rw]

  

Handler for a character entered by the user.

  property ParentWindow: HWND; [rw]

  

The Handle of the parent widget.

  property Showing: Boolean; [r]

  

Cached widget visibility, not necessarily in sync with the widget.

  property UseDockManager: Boolean; [rw]

  

Determines whether a DockManager is used for this DockSite.

  property DesignerDeleting: Boolean; [rw]

  property VisibleDockClientCount: Integer; [r]

  

The number of visible docked controls.

  function AutoSizePhases; override;

  

Translates state flags into AutoSizePhases

  function AutoSizeDelayed; override;

  

Returns true if auto-sizing must be has been delayed, until some other process is complete.

  function AutoSizeDelayedReport; override;

  function AutoSizeDelayedHandle; override;

  

Returns true if AutoSize should be skipped / delayed because of its handle.

  procedure BeginUpdateBounds;

  

Start of Bounds updates. Disables SetBounds by incrementing BoundsLockCount.

  procedure EndUpdateBounds;

  

End of Bounds update. Decrements BoundsLockCount and eventually calls SetBounds.

  procedure LockRealizeBounds;

  

Disables sending bounds to the widget, by incrementing FRealizeBoundsLockCount.

  procedure UnlockRealizeBounds;

  

Enables sending bounds to the widget again, eventually updates the widget.

  function ControlAtPos();

  

Get the child control at the given client position.

  function ContainsControl();

  

Returns True if this is a parent of the given control.

  procedure DoAdjustClientRectChange();

  

Asks the widget if clientrect has changed since last AlignControl, and calls AdjustSize on change.

  procedure InvalidateClientRectCache();

  

The ClientRect is cached. Call this procedure to invalidate the cache, so that next time the ClientRect is fetched from the widget.

  function ClientRectNeedsInterfaceUpdate;

  

The ClientRect is cached - check if the cache is valid.

  procedure SetBounds(); override;

  

Sets the bounds (left, top, width, height) of the control.

  function GetChildrenRect(); override;

  procedure DisableAlign;

  procedure EnableAlign;

  procedure ReAlign;

  procedure ScrollBy_WS();

  procedure ScrollBy(); virtual;

  

Move all child controls.

  procedure WriteLayoutDebugReport(); override;

  

Used for debugging.

  procedure AutoAdjustLayout(); override;

  constructor Create(); override;

  constructor CreateParented();

  

Constructor for a control that is the child of the given widget.

  class function CreateParentedControl();

  destructor Destroy; override;

  procedure DockDrop(); virtual;

  

Handler for a DragManager dmDragDrop message, sent when a dragged control has been dropped onto this docksite.

  function CanFocus; virtual;

  

Is this control allowed to receive the focus when parent form is visible?

  function CanSetFocus; virtual;

  

Is this control allowed to receive the focus?

  function GetControlIndex();

  

Finds the index value for the given control, in Controls[].

  procedure SetControlIndex();

  function Focused; virtual;

  

Checks whether the control has the focus.

  function PerformTab(); virtual;

  

Sets the focus to the next (or preceding) control.

  function FindChildControl();

  

Finds a child control by name.

  procedure SelectNext();

  

Transfers the focus to the next child control.

  procedure SetTempCursor(); override;

  

Change the cursor shape temporarily, preserving the stored TControl.Cursor.

  procedure BroadCast();

  

Sends a message to all child controls.

  procedure NotifyControls();

  

Sends a message to all child controls.

  procedure DefaultHandler(); override;

  

Handles all messages that the control doesn't fully handle itself.

  function GetTextLen; override;

  

The length of Text, here: of Caption.

  procedure Invalidate; override;

  

Schedule an repaint request.

  procedure AddControl; virtual;

  

Tell widgetset to add Handle object to parent's Handle object.

  procedure InsertControl();

  

Insert control into Controls[].

  procedure RemoveControl(); virtual;

  

Remove control from Controls[].

  function GetEnumeratorControls;

  function GetEnumeratorControlsReverse;

  procedure Repaint; override;

  

Immediate redraw of the control, bypassing the message queue.

  procedure Update; override;

  

Redraw invalidated parts of the control immediately.

  procedure SetFocus; virtual;

  procedure FlipChildren(); virtual;

  

Flip children horizontally. That means mirroring the Left position and anchoring.

  procedure ScaleBy();

  function GetDockCaption(); virtual;

  

Returns the caption for the docked control.

  procedure UpdateDockCaption(); virtual;

  

Updates the Caption to reflect the names of the docked clients.

  procedure GetTabOrderList(); virtual;

  

Fill the list with all TabStop controls, recursing into child controls.

  function HandleAllocated;

  

Check whether a widget has been assigned to this control.

  function ParentHandlesAllocated; override;

  

Returns True if all Parents have handles allocated, and are not being destroyed.

  procedure HandleNeeded;

  

Call this method when your code requires a valid Handle for this control.

  function BrushCreated;

  

Has a Brush been created for this control?

  procedure EraseBackground(); virtual;

  

Fills the entire control with the designed background color and pattern.

  function IntfUTF8KeyPress(); virtual;

  

Called by the interface after the navigation and specials keys are handled; i.e. after KeyDown but before KeyPress.

  function IntfGetDropFilesTarget; virtual;

  procedure PaintTo();

  

Paints only when a widget exists.

  procedure SetShape();

  

Specifies the (non-rectangular) shape of the widget.

Inheritance

TWinControl

  

The base class for controls which can contain other (child) controls.

|

TControl

  

The base class for visible controls.

|

TLCLComponent

  

The base class for LCL components associated with widgets.

|

TComponent

?

TObject

Description

The name reflects the fact that (on Windows) these controls are based on OS provided widgets, which have window Handles.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.