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

TControl

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

The base class for visible controls.

Declaration

Source position: controls.pp line 1196

type TControl = class(TLCLComponent)

protected

  FAccessibleObject: TLazAccessibleObject;

  

Member with the accessibility object for the control.

  FControlState: TControlState;

  

Member with the value for the ControlState property.

  FCursor: TCursor;

  

Member with the value for the Cursor property.

  class procedure WSRegisterClass; override;

  

Registers this component class with the current WidgetSet.

  function GetCursor; virtual;

  

Gets the value for the Cursor property.

  procedure SetCursor(); virtual;

  

Sets the value for the Cursor property.

  procedure SetVisible(); virtual;

  

Sets the value for the Visible property.

  procedure DoOnParentHandleDestruction; virtual;

  

Performs actions needed when the handle for the parent control is freed.

  procedure DoAutoSize; virtual;

  

For internal use only; call AdjustSize instead.

  procedure DoAllAutoSize; virtual;

  

Resizes and aligns the control and all of it children.

  procedure BeginAutoSizing;

  

Sets AutoSizing to True; used to prevent loops.

  procedure EndAutoSizing;

  

End of the auto-sizing process, resets AutoSizing to False.

  procedure AnchorSideChanged(); virtual;

  

Request further processing after an anchor side was changed.

  procedure ForeignAnchorSideChanged(); virtual;

  

Requests further processing after an anchor side has changed, that anchors another control to this one.

  procedure SetAlign(); virtual;

  

Sets the value for the Align property.

  procedure SetAnchors(); virtual;

  

Sets the value for the Anchors property.

  procedure SetAutoSize(); virtual;

  

Sets the value for the AutoSize property.

  procedure BoundsChanged; virtual;

  

Called when the Bounds of the control have been changed; override as required.

  function CreateControlBorderSpacing; virtual;

  

Creates the default BorderSpacing object instance for the class.

  procedure DoConstraintsChange(); virtual;

  

Performs actions needed when value(s) in Constraints have been changed.

  procedure DoBorderSpacingChange(); virtual;

  

Performs actions needed when border spacing for the control is changed.

  function IsBorderSpacingInnerBorderStored; virtual;

  

Checks for an assigned value in BorderSpacing.InnerBorder.

  function IsCaptionStored;

  

Implements the storage specifier for the Caption property.

  procedure SendMoveSizeMessages(); virtual;

  

Sends Move and Size messages through the LCL message paths.

  procedure ConstrainedResize(); virtual;

  

Signals the OnConstrainedResize handler.

  procedure CalculatePreferredSize(); virtual;

  

Override this method to return the preferred height and width for the control.

  procedure DoOnResize; virtual;

  

Signals OnResize event handlers for the control.

  procedure DoOnChangeBounds; virtual;

  

Signals OnChangeBounds event handlers for the control.

  procedure CheckOnChangeBounds;

  

Checks for changes and calls DoOnChangeBounds if needed.

  procedure Resize; virtual;

  

Checks for changes and calls DoOnResize if needed.

  procedure RequestAlign; virtual;

  

Asks the parent control to realign all controls that are siblings.

  procedure UpdateAnchorRules;

  

Update the rules for anchoring the control.

  procedure ChangeBounds(); virtual;

  

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

  procedure DoSetBounds(); virtual;

  

Internal function used to set the bounds for the control (Left, Top, Height, Width).

  procedure ScaleConstraints();

  

Scales the minimum and maximum Width and Height.

  procedure ChangeScale(); virtual;

  

Applies scaling (multiplier and divider) to the bounds coordinates, constraints, and Font in a control.

  function CanAutoSize(); virtual;

  

Determines if auto-sizing is possible, and if so, gets the new width and height when enabled.

  procedure SetBiDiMode(); virtual;

  

Sets the value for the BiDiMode property.

  procedure SetParentBiDiMode(); virtual;

  

Sets the value for the ParentBiDiMode property.

  function IsAParentAligning;

  

Determines if a parent control is involved in the alignment process for the control.

  function GetClientOrigin; virtual;

  

Gets the value for the ClientOrigin property.

  function GetClientRect; virtual;

  

Gets the value for the ClientRect property.

  function GetLogicalClientRect; virtual;

  

Logical client area, can be bigger than the visible client area.

  function GetScrolledClientRect; virtual;

  

Get the visible part of the logical client area.

  function GetClientScrollOffset; virtual;

  

Returns the offset of the scrolled client area (in a scrolling TWinControl).

  function GetControlOrigin; virtual;

  

Gets the value for the ControlOrigin property.

  function IsClientHeightStored; virtual;

  

Implements the storage specifier for the ClientHeight property.

  function IsClientWidthStored; virtual;

  

Implements the storage specifier for the ClientWidth property.

  function WidthIsAnchored;

  

True when both the control's left and right side are anchored.

  function HeightIsAnchored;

  

True when both the control's top and bottom side are anchored.

  property AutoSizing: Boolean; [r]

  

Contains True while auto-sizing is in progress.

  property AutoSizingAll: Boolean; [r]

  

Flag to prevent recursive AutoSizing (in DoAllAutoSize).

  property AutoSizingLockCount: Integer; [r]

  

Internal counter increased and decreased in the DisableAutoSizing and EnableAutoSizing methods.

  procedure WMCancelMode(); message;

  

Handles a LM_CANCELMODE message for the control.

  procedure WMContextMenu(); message;

  

Handles a LM_CONTEXTMENU message for the control.

  procedure WMLButtonDown(); message;

  

Handles a LM_LBUTTONDOWN (left mouse button down) message for the control.

  procedure WMRButtonDown(); message;

  

Handles a LM_RBUTTONDOWN (right mouse button down) message for the control.

  procedure WMMButtonDown(); message;

  

Handles a LM_MBUTTONDOWN (middle mouse button down) message for the control.

  procedure WMXButtonDown(); message;

  

Handles a LM_XBUTTONDOWN (extra mouse button down) message for the control.

  procedure WMLButtonDBLCLK(); message;

  

Handles a left mouse button double click message for the control.

  procedure WMRButtonDBLCLK(); message;

  

Message handler for right mouse button double click events.

  procedure WMMButtonDBLCLK(); message;

  

Message handler for middle mouse button double click events.

  procedure WMXButtonDBLCLK(); message;

  

Message handler for extra mouse button double click events.

  procedure WMLButtonTripleCLK(); message;

  

Message handler for left mouse button triple click events.

  procedure WMRButtonTripleCLK(); message;

  

Message handler for right mouse button triple click events.

  procedure WMMButtonTripleCLK(); message;

  

Message handler for middle mouse button triple click events.

  procedure WMXButtonTripleCLK(); message;

  

Message handler for extra mouse button triple click events.

  procedure WMLButtonQuadCLK(); message;

  

Message handler for left mouse button quadruple click events.

  procedure WMRButtonQuadCLK(); message;

  

Message handler for right mouse button quadruple click events.

  procedure WMMButtonQuadCLK(); message;

  

Message handler for middle mouse button quadruple click events.

  procedure WMXButtonQuadCLK(); message;

  

Message handler for extra mouse button quadruple click events.

  procedure WMMouseMove(); message;

  

Message handler for mouse move events.

  procedure WMLButtonUp(); message;

  

Message handler for left mouse button up events.

  procedure WMRButtonUp(); message;

  

Message handler for right mouse button up events.

  procedure WMMButtonUp(); message;

  

Message handler for middle mouse button up events.

  procedure WMXButtonUp(); message;

  

Message handler for extra mouse button up events.

  procedure WMMouseWheel(); message;

  

Handles mouse wheel messages for the control.

  procedure WMMouseHWheel(); message;

  

Handles horizontal mouse wheel messages for the control.

  procedure WMMove(); message;

  

Message handler for control move events.

  procedure WMSize(); message;

  

Message handler for changed control size.

  procedure WMWindowPosChanged(); message;

  

Message handler for changed control position events.

  procedure CMChanged(); message;

  

Handles CM_CHANGED control messages for the control.

  procedure LMCaptureChanged(); message;

  

Handles a LM_CaptureChanged message for the control.

  procedure CMBiDiModeChanged(); message;

  

Handles CM_BIDIMODECHANGED messages for the control.

  procedure CMSysFontChanged(); message;

  

Handles the CM_SYSFONTCHANGED message for the control.

  procedure CMEnabledChanged(); message;

  

Handles a CM_ENABLEDCHANGED message for the control.

  procedure CMHitTest(); message;

  

Handles the CM_HITTEST message for the control.

  procedure CMMouseEnter(); message;

  

Handles a CM_MOUSEENTER message for the control.

  procedure CMMouseLeave(); message;

  

Handles a CM_MOUSELEAVE message for the control.

  procedure CMHintShow(); message;

  

Handles the CM_HINTSHOW message for the control.

  procedure CMParentBiDiModeChanged(); message;

  

Handles a CM_PARENTBIDIMODECHANGED message for the control.

  procedure CMParentColorChanged(); message;

  

Handles a CM_PARENTCOLORCHANGED message for the control.

  procedure CMParentFontChanged(); message;

  

Handles a CM_PARENTFONTCHANGED message for the control.

  procedure CMParentShowHintChanged(); message;

  

Handles a CM_PARENTSHOWHINTCHANGED message for the control.

  procedure CMVisibleChanged(); message;

  

Handles a CM_VISIBLECHANGED message for the control.

  procedure CMTextChanged(); message;

  

Handles a CM_TEXTCHANGED message for the control.

  procedure CMCursorChanged(); message;

  

Handles the CM_CURSORCHANGED message for the control.

  procedure CalculateDockSizes;

  

Saves the docked and undocked extent of the control.

  function CreateFloatingDockSite();

  

Create a floating dock site with a client area equal to the given screen coordinates.

  function GetDockEdge(); virtual;

  

Determines the side to which the dragged control shall be docked.

  function GetDragImages; virtual;

  

Get the list of images used when a drag operation is active.

  function GetFloating; virtual;

  

Determines whether the control is floating.

  function GetFloatingDockSiteClass; virtual;

  

Returns the class for a floating host dock site.

  procedure BeforeDragStart; virtual;

  

Performs actions needed before a drag operation is started for the control.

  procedure BeginAutoDrag; virtual;

  

For internal use: user has started dragging the control.

  procedure DoFloatMsg(); virtual;

  

Handler called when the control starts floating.

  procedure DockTrackNoTarget(); virtual;

  

Adjust the DockRect for floating state (no drop target under the mouse).

  procedure DoDock(); virtual;

  

Adjusts the control position and extent for the new docksite.

  function DoDragMsg(); virtual;

  

Handler for a drag message, sent by the DragManager to the current target control.

  procedure DoEndDock(); virtual;

  

Signals the OnEndDock event handler when the control has been undocked.

  procedure DoEndDrag(); virtual;

  

Signals the OnEndDrag event handler.

  procedure DoStartDock(); virtual;

  

Signals the OnStartDock event handler.

  procedure DoStartDrag(); virtual;

  

Signals the OnStartDrag event handler.

  procedure DragCanceled; virtual;

  

Notifies the control of a cancelled drag operation.

  procedure DragOver(); virtual;

  

Called when an object is dragged over this control; Determines whether a drop is acceptable, using the OnDragOver handler.

  procedure PositionDockRect(); virtual;

  

Get the DockRect for an possible drop.

  procedure SetDragMode(); virtual;

  

Sets the value for the DragMode property.

  function GetDefaultDockCaption; virtual;

  

Returns the string for the dock caption, by default the control's Name.

  procedure Click; virtual;

  

Signals OnClick and/or executes the ActionLink when the control has been clicked.

  procedure DblClick; virtual;

  

Signals the OnDblClick event handler (when assigned).

  procedure TripleClick; virtual;

  

Signals the OnTripleClick event handler (when assigned).

  procedure QuadClick; virtual;

  

Signals the OnQuadClick event handler (when assigned).

  function GetMousePosFromMessage();

  

Converts the coordinates in the mouse message from SmallInt to LongInt values.

  procedure DoMouseDown(); virtual;

  

Performs actions needed to handle a mouse down event for the control.

  procedure DoMouseUp(); virtual;

  

Performs actions needed to handle a mouse up event for the control.

  procedure MouseDown(); virtual;

  

Handles a mouse down event for the control.

  procedure MouseMove(); virtual;

  

Handler for MouseMove events.

  procedure MouseUp(); virtual;

  

Signals the OnMouseUp handler.

  procedure MouseEnter; virtual;

  

Signals the OnMouseEnter event handler (when assigned).

  procedure MouseLeave; virtual;

  

Signals the OnMouseLeave event handler (when assigned).

  function DialogChar(); virtual;

  

Performs actions needed to handle an accelerator key for the control.

  procedure UpdateMouseCursor();

  

Changes the cursor shape to the value in the Cursor property.

  procedure Changed;

  

Performs actions needed when the value for the control has been changed.

  function GetPalette; virtual;

  

Override GetPalette to return the handle of a color palette.

  function GetParentBackground;

  

Gets the value for the ParentBackground property.

  function ChildClassAllowed(); virtual;

  

Returns True if the specified class is allowed for children of this control.

  procedure ReadState(); override;

  

Updates control flags and reads the data for the component.

  procedure Loaded; override;

  

Performs actions needed when LCL component streaming has been completed.

  procedure LoadedAll; virtual;

  

Called when the control and its child controls have been loaded, and their control state is changed.

  procedure DefineProperties(); override;

  

Defines which non-published properties should be streamed (none here).

  procedure AssignTo(); override;

  

Implements assignment of the control to an Action object, or calls the inherited method.

  procedure FormEndUpdated; virtual;

  

Called for each control on a form where the update count has reached 0 (zero).

  procedure InvalidateControl();

  

Requests a repaint of the control.

  procedure FontChanged(); virtual;

  

Handles changes to the Font property.

  procedure ParentFontChanged; virtual;

  

[Delphi compatible] Does nothing here, all work is done in CMParentFontChanged.

  function GetAction; virtual;

  

Gets the value for the Action property.

  function RealGetText; virtual;

  

Returns the Caption property.

  procedure RealSetText(); virtual;

  

Sets the value for the Caption property.

  procedure TextChanged; virtual;

  

Performs actions needed when the value for the Text property has been changed.

  function GetCachedText(); virtual;

  

Returns the cached Text property (FCaption).

  procedure SetAction(); virtual;

  

Sets the value for the Action property.

  procedure SetColor(); virtual;

  

Sets the value for the Color property.

  procedure SetEnabled(); virtual;

  

Sets the value for the Enabled property.

  procedure SetHint(); virtual;

  

Sets the value for the Hint property.

  procedure SetName(); override;

  

Sets the value for the Name property.

  procedure SetParent(); virtual;

  

Sets the value for the Parent property.

  procedure SetParentBackground(); virtual;

  

Sets the value for the ParentBackground property.

  procedure SetParentComponent(); override;

  

Sets the value in the Parent property when the new parent component is a TWinControl instance.

  procedure WndProc(); virtual;

  

The general message handler for this control.

  procedure ParentFormHandleInitialized; virtual;

  

Internal handler for activities after a form widget has been created.

  function GetMouseCapture; virtual;

  

Gets the value for the MouseCapture property.

  procedure CaptureChanged; virtual;

  

Handler for mouse capture moved to a different control.

  procedure Notification(); override;

  

Notification handler for insertion or deletion of components in the control.

  function CanTab; virtual;

  

Determines whether the Tab key can be used for navigation in the control.

  function GetDeviceContext(); virtual;

  

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

  function GetEnabled; virtual;

  

Gets the value for the Enabled property.

  function GetPopupMenu; virtual;

  

Gets the value for the PopupMenu property.

  procedure DoOnShowHint(); virtual;

  

Signals the OnShowHint event handler.

  function DoMouseWheel(); virtual;

  

Signals the OnMouseWheel handlers, when the mouse wheel has been turned.

  function DoMouseWheelDown(); virtual;

  

Signals the OnMouseWheelDown handler.

  function DoMouseWheelUp(); virtual;

  

Signals the OnMouseWheelUp handler.

  function DoMouseWheelHorz(); virtual;

  

Performs actions needed to handle horizontal mouse wheel events.

  function DoMouseWheelLeft(); virtual;

  

Signals the OnMouseWheelLeft event handler (when assigned).

  function DoMouseWheelRight(); virtual;

  

Signals the OnMouseWheelRight event handler.

  procedure VisibleChanging; virtual;

  

Notifies all chtOnVisibleChanging handlers for the control.

  procedure VisibleChanged; virtual;

  

Notifies all chtOnVisibleChanged handlers for the control.

  procedure EnabledChanging; virtual;

  

Notifies all chtOnEnabledChanging handlers for the control.

  procedure EnabledChanged; virtual;

  

Notifies all chtOnEnabledChanged handlers for the control.

  procedure AddHandler();

  

Adds a notification handler for the specified control handler type.

  procedure RemoveHandler();

  

Removes a notification handler from the list for the specified handler type.

  procedure DoCallNotifyHandler();

  

Signals handler routines for the specified control handler type.

  procedure DoCallKeyEventHandler();

  

Passes key events for the specified type to the handlers added to the control.

  procedure DoCallMouseWheelEventHandler();

  

Executes assigned mouse wheel events until a handler is found for the event notifications.

  procedure DoContextPopup(); virtual;

  

Signals the OnContextPopup handler.

  procedure SetZOrder(); virtual;

  

Moves the control in front of or behind all sibling controls.

  class function GetControlClassDefaultSize; virtual;

  

Returns the default dimensions for new instances of the class.

  function ColorIsStored; virtual;

  

Implements the storage specifier for the Color property.

  procedure DoAutoAdjustLayout(); virtual;

  

Applies layout changes using the specified policy and scaling proportions to the control.

  procedure DoFixDesignFontPPI();

  

Applies the design-time PPI and resizes the specified control font.

  procedure DoScaleFontPPI();

  

Implements the ScaleFontsPPI method for the control.

  function GetActionLinkClass; virtual;

  

The default ActionLink class (TControlActionLink).

  procedure ActionChange(); virtual;

  

Handler for a changed Action.

  property ActionLink: TControlActionLink; [rw]

  

Link to the default Action associated with this control.

  property DesktopFont: Boolean; [rw]

  

Indicates if the desktop (system) font is used for the text displayed on this control.

  property DragCursor: TCursor; [rw]

  

The cursor shape shown during a drag operation.

  property DragKind: TDragKind; [rw]

  

Indicates the action performed for a drag operation: drag-and-drop or drag-and-dock.

  property DragMode: TDragMode; [rw]

  

Determines how a drag operation is started for the control.

  property MouseCapture: Boolean; [rw]

  

True when mouse messages are currently captured by this control.

  property ParentBackground: Boolean; [rw]

  

Indicates if the control uses the background color from its Parent control.

  property ParentColor: Boolean; [rw]

  

Use the Color from the Parent control, when enabled.

  property ParentFont: Boolean; [rw]

  

Indicates if the Font from the Parent control is used in the control.

  property ParentShowHint: Boolean; [rw]

  

If True, the value of ShowHint for the control will be the same as the one from the Parent. Default is True.

  property SessionProperties: string; [rw]

  

Delimited list of property or sub-component property names saved to and restored from an external storage mechanism.

  property Text: TCaption; [rw]

  

String with the text or caption for the control.

  property OnConstrainedResize: TConstrainedResizeEvent; [rw]

  

This handler can supply specific Constraints (size limits), when the control is resized.

  property OnContextPopup: TContextPopupEvent; [rw]

  

Invoked when a context-sensitive pop-up menu is requested.

  property OnDblClick: TNotifyEvent; [rw]

  

Event handler signalled when a mouse double click occurs in the control.

  property OnTripleClick: TNotifyEvent; [rw]

  

Event handler signalled when a mouse triple click occurs in the control.

  property OnQuadClick: TNotifyEvent; [rw]

  

Event handler signalled when a mouse quadruple mouse occurs in the control.

  property OnDragDrop: TDragDropEvent; [rw]

  

Event handler signalled when an object is dropped onto the control.

  property OnDragOver: TDragOverEvent; [rw]

  

Event handler signalled when a control is dragged over the control instance.

  property OnEndDock: TEndDragEvent; [rw]

  

Event handler signalled for the end of a drag-dock operation.

  property OnEndDrag: TEndDragEvent; [rw]

  

Event handler signalled for the end of a drag-drop operation.

  property OnMouseDown: TMouseEvent; [rw]

  

Event handler signalled when a mouse down event is handled for the control.

  property OnMouseMove: TMouseMoveEvent; [rw]

  

Event handler signalled when the mouse pointer is moved in the control.

  property OnMouseUp: TMouseEvent; [rw]

  

Event handler signalled when a mouse up event is handled for the control.

  property OnMouseEnter: TNotifyEvent; [rw]

  

Event handler signalled when the mouse pointer has entered the control.

  property OnMouseLeave: TNotifyEvent; [rw]

  

Event handler signalled when the mouse pointer has left the control.

  property OnMouseWheel: TMouseWheelEvent; [rw]

  

Event handler for mouse wheel turned.

  property OnMouseWheelDown: TMouseWheelUpDownEvent; [rw]

  

Event handler signalled for a downward movement of the mouse wheel.

  property OnMouseWheelUp: TMouseWheelUpDownEvent; [rw]

  

Event handler signalled for an upward movement of the mouse wheel.

  property OnMouseWheelHorz: TMouseWheelEvent; [rw]

  

Event handler signalled for a horizontal movement of the mouse wheel.

  property OnMouseWheelLeft: TMouseWheelUpDownEvent; [rw]

  

Event handler signalled for a leftward movement of the mouse wheel.

  property OnMouseWheelRight: TMouseWheelUpDownEvent; [rw]

  

Event handler signalled for a rightward movement of the mouse wheel.

  property OnStartDock: TStartDockEvent; [rw]

  

Event handler for the start of a docking operation.

  property OnStartDrag: TStartDragEvent; [rw]

  

Event handler signalled for the start of a dragging operation.

  property OnEditingDone: TNotifyEvent; [rw]

  

Event handler signalled when editing is completed for the control.

public

  FCompStyle: Byte;

  

Deprecated.

  procedure DragDrop(); virtual;

  

Signals the OnDragDrop handler when a dragged object is dropped onto this control.

  procedure Dock(); virtual;

  

Moves the control into a new docksite.

  function ManualDock(); virtual;

  

Docks a control programmatically.

  function ManualFloat(); virtual;

  

Undocks the control into a floating dock site.

  function ReplaceDockedControl();

  

Replaces a previously docked control.

  function Docked;

  

Indicates if the control has a host dock site.

  function Dragging;

  

Returns True if the control is being dragged.

  function GetAccessibleObject;

  

Returns True if the control is being dragged.

  function CreateAccessibleObject; virtual;

  

Creates a TLazAccessibleObject instance for this control.

  function GetSelectedChildAccessibleObject; virtual;

  

Returns the currently selected child accessibility object.

  function GetChildAccessibleObjectAtPos(); virtual;

  

Returns the child accessibility object at the given position for the control.

  function ScaleDesignToForm();

  

Scales a size value from the design-time PPI to the run-time PPI for the parent form.

  function ScaleFormToDesign();

  

Scales a size value from the run-time PPI for the parent form to the design-time PPI.

  function Scale96ToForm();

  

Scales a size value from 96 PPI to the run-time PPI for the Screen.

  function ScaleFormTo96();

  

Scales a size value from the PPI for the Parent form (or designer control) to 96 PPI.

  function Scale96ToFont();

  

Scales a size value from 96 PPI to the PPI setting for the Font in the control.

  function ScaleFontTo96();

  

Scales a size value from the PPI setting in the Font for the control to 96 PPI.

  function ScaleScreenToFont();

  

Scales a size value from the PPI setting for the Screen to the PPI setting for the Font in the control.

  function ScaleFontToScreen();

  

Scales a size value from the PPI setting for the Font to the PPI setting for the Screen.

  function Scale96ToScreen();

  

Scales a size value from 96 PPI to the PPI setting for the Screen.

  function ScaleScreenTo96();

  

Scales a size value from the PPI setting for the Screen to 96 PPI.

  procedure AdjustSize; virtual;

  

Smart way to DoAutoSize.

  function AutoSizePhases; virtual;

  

Auto-sizing phases enabled for the control.

  function AutoSizeDelayed; virtual;

  

Returns True if auto-sizing has been delayed until some other process is complete.

  function AutoSizeDelayedReport; virtual;

  

Returns a string with a debugging message for delayed auto-size requests.

  function AutoSizeDelayedHandle; virtual;

  

Returns True if AutoSize should be skipped or delayed because of its handle.

  procedure AnchorToNeighbour();

  

Anchor to Sibling at Side.

  procedure AnchorParallel();

  

Anchor parallel to Sibling, at Side.

  procedure AnchorHorizontalCenterTo();

  

Anchors the horizontal center of the control to the center of the specified sibling.

  procedure AnchorVerticalCenterTo();

  

Anchors the vertical center of the control to the center of the specified Sibling.

  procedure AnchorToCompanion();

  

Anchor to Sibling at Side, with the same extent.

  procedure AnchorSame();

  

Copy Sibling's anchoring for Side.

  procedure AnchorAsAlign();

  

Anchor to the Parent using the Align value for the control.

  procedure AnchorClient();

  

Anchor to Parent's full client area.

  function AnchoredControlCount;

  

The number of controls anchored to the current control.

  property AnchoredControls []: TControl; [r]

  

Provides indexed access to controls which are anchored to the current control by their ordinal position.

  procedure SetBounds(); virtual;

  

Sets the bounds (Left, Top, Width, Height) of the control.

  procedure SetInitialBounds(); virtual;

  

Sets the bounds of the control initially, when it is created.

  procedure SetBoundsKeepBase(); virtual;

  

Set the bounds, keeping the base values.

  procedure GetPreferredSize(); virtual;

  

Returns default/preferred height and width, for use in auto-sizing.

  function GetCanvasScaleFactor;

  

Gets the scaling factor for the canvas used to render the control.

  function GetDefaultWidth;

  

The default width for the control independent of any calculated values like Width and GetPreferredSize.

  function GetDefaultHeight;

  

The default height for the control independent of any calculated values like Height and GetPreferredSize.

  function GetDefaultColor(); virtual;

  

Gets the default color for the control.

  function GetColorResolvingParent;

  

Returns the color of the control while resolving clDefault and ParentColor.

  function GetRGBColorResolvingParent;

  

Returns a RGB value for the color used on the control.

  function GetSidePosition();

  

Gets the client coordinate for the specified side.

  procedure CNPreferredSizeChanged;

  

Message handler for preferred size changed.

  procedure InvalidatePreferredSize; virtual;

  

Marks the preferred size as invalid for this control and all parents (implies that we will look for another).

  function GetAnchorsDependingOnParent();

  

Returns the sides which are anchored to the Parent.

  procedure DisableAutoSizing;

  

Disables automatic sizing; implies that the default size is accepted, or sizing is done manually.

  procedure EnableAutoSizing;

  

Enables automatic sizing for the control.

  procedure UpdateBaseBounds(); virtual;

  

Updates the base bounds for the control; essential if there has been a lot of resizing.

  property BaseBounds: TRect; [r]

  

The rectangle with the designed bounds for the control.

  property ReadBounds: TRect; [r]

  

Reflects the Bounds for the Control read during LCL component streaming.

  property BaseParentClientSize: TSize; [r]

  

The client size for the Parent, for which the BaseBounds are valid.

  procedure WriteLayoutDebugReport(); virtual;

  

Used for debugging.

  procedure AutoAdjustLayout(); virtual;

  

Applies an automatic adjustment layout policy to the control.

  procedure ShouldAutoAdjust(); virtual;

  

Indicates whether the height and/or width for a control can be automatically adjusted.

  procedure FixDesignFontsPPI(); virtual;

  

Corrects the font size for High-DPI-aware applications.

  procedure ScaleFontsPPI(); virtual;

  

Resizes a font to the specified Pixels per Inch setting.

  constructor Create(); override;

  

Constructor for the class instance.

  destructor Destroy; override;

  

Removes the control from its Parent.

  procedure BeforeDestruction; override;

  

Performs notifications before the control is destroyed.

  procedure EditingDone; virtual;

  

Signals the OnEditingDone event handler.

  procedure ExecuteDefaultAction; virtual;

  

Called when the Return key is pressed, signifying the default action.

  procedure ExecuteCancelAction; virtual;

  

Called when the Escape key is pressed or the Cancel button is clicked.

  procedure BeginDrag();

  

Starts a drag operation for the control (programmatically).

  procedure EndDrag();

  

Ends a drag operation by notifying the drag manager.

  procedure BringToFront;

  

Brings the control in front of other sibling controls.

  function HasParent; override;

  

Returns True if there is a Parent component responsible for streaming.

  function GetParentComponent; override;

  

Returns the value in the Parent property.

  function IsParentOf(); virtual;

  

Determines whether this control is a parent of AControl.

  function GetTopParent;

  

Finds the control that is the top-most Parent in the control hierarchy.

  function FindSubComponent();

  

Finds the sub-component with the specified name in the Components property.

  function IsVisible; virtual;

  

Gets the effective visibility for the control and all of its Parent controls.

  function IsControlVisible; virtual;

  

True if the control is Visible, or is in design mode.

  function IsEnabled;

  

Returns True if both the control and all of its Parent controls are Enabled.

  function IsParentColor;

  

Provides access to the value in the protected ParentColor property.

  function IsParentFont;

  

Provides access to the value in the protected ParentFont property.

  function FormIsUpdating; virtual;

  

True if the form is being updated.

  function IsProcessingPaintMsg;

  

True while painting the control.

  procedure Hide;

  

Hides the control by setting the Visible property to False.

  procedure Refresh;

  

Causes the control to be redrawn.

  procedure Repaint; virtual;

  

Immediately redraws the control when visible, bypassing the message queue.

  procedure Invalidate; virtual;

  

Causes a delayed Repaint of the control by marking its visible area of the control as invalid.

  function CheckChildClassAllowed();

  

Returns True if the class is allowed for child controls.

  procedure CheckNewParent(); virtual;

  

Checks if this control can become a child of AParent.

  procedure SendToBack;

  

Moves all sibling controls in front of this control.

  procedure SetTempCursor(); virtual;

  

Changes the cursor shape temporarily, preserving the original TControl.Cursor

  procedure UpdateRolesForForm; virtual;

  

Internal method called by a Form when its DefaultControl or CancelControl has changed.

  procedure ActiveDefaultControlChanged(); virtual;

  

Notification of a changed active DefaultControl of a form.

  function GetTextBuf(); virtual;

  

Copy the Text property into Buffer.

  function GetTextLen; virtual;

  

The length of the Text for the control.

  procedure SetTextBuf(); virtual;

  

Updates the Text property from a PChar buffer.

  function Perform();

  

Calls a message handler directly, bypassing the message queue.

  function ScreenToClient(); virtual;

  

Converts absolute screen coordinates into client-relative coordinates.

  function ClientToScreen();

  

Converts client-relative coordinates to absolute screen coordinates.

  function ScreenToControl();

  

Converts absolute screen coordinates to control-relative coordinates.

  function ControlToScreen();

  

Converts control-relative coordinates to absolute screen coordinates.

  function ClientToParent();

  

Converts the specified client coordinates to the screen coordinates for the specified parent control.

  function ParentToClient();

  

Converts the specified client coordinates on a parent control to the client coordinates for the control instance.

  function GetChildrenRect(); virtual;

  

Get the visible part of a possibly scrolled client area.

  procedure Show;

  

Makes the control visible by setting Visible to True.

  procedure Update; virtual;

  

Redraws invalidated parts of the control immediately.

  function HandleObjectShouldBeVisible; virtual;

  

True if the control should be visible, unless it's being destroyed.

  function ParentDestroyingHandle;

  

Returns True if any parent control is destroying its Handle (or handles for its children).

  function ParentHandlesAllocated; virtual;

  

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

  procedure InitiateAction; virtual;

  

Updates the action associated with the control using its action link.

  procedure ShowHelp; virtual;

  

Displays the help associated with the control.

  function HasHelp;

  

Indicates whether a HelpKeyword or HelpContext identifier is assigned for the control.

  procedure RemoveAllHandlersOfObject(); override;

  

Removes all control handler types for the specified object.

  procedure AddHandlerOnResize();

  

Adds or inserts the specified OnResize event handler.

  procedure RemoveHandlerOnResize();

  

Removes the specified OnResize event handler.

  procedure AddHandlerOnChangeBounds();

  

Adds or inserts the specified OnChangeBounds event handler.

  procedure RemoveHandlerOnChangeBounds();

  

Removes the specified OnChangeBounds event handler.

  procedure AddHandlerOnVisibleChanging();

  

Adds or inserts the specified OnVisibleChanging event handler.

  procedure RemoveHandlerOnVisibleChanging();

  

Removes the specified OnVisibleChanging event handler.

  procedure AddHandlerOnVisibleChanged();

  

Adds or inserts the specified OnVisibleChanged event handler.

  procedure RemoveHandlerOnVisibleChanged();

  

Removes the specified OnVisibleChanged event handler.

  procedure AddHandlerOnEnabledChanging();

  

Adds the specified OnEnabledChanging handler.

  procedure RemoveHandlerOnEnabledChanging();

  

Removes the specified OnEnabledChanging event handler.

  procedure AddHandlerOnEnabledChanged();

  

Adds an OnEnabledChanged handler.

  procedure RemoveHandlerOnEnabledChanged();

  

Removes the specified OnEnabledChanged event handler.

  procedure AddHandlerOnKeyDown();

  

Adds the specified OnKeyDown event handler.

  procedure RemoveHandlerOnKeyDown();

  

Removes the specified OnKeyDown event handler.

  procedure AddHandlerOnBeforeDestruction();

  

Adds or inserts the specified OnBeforeDestruction event handler.

  procedure RemoveHandlerOnBeforeDestruction();

  

Removes the specified OnBeforeDestruction event handler.

  procedure AddHandlerOnMouseWheel();

  

Adds or inserts the specified OnMouseWheel event handler.

  procedure RemoveHandlerOnMouseWheel();

  

Removes the specified OnMouseWheel event handler.

  property AccessibleName: TCaption; [rw]

  

Contains the accessible name for the control, like the value for its Caption or Name property.

  property AccessibleDescription: TCaption; [rw]

  

Provides the accessibility description for the control, like "a text caption", etc.

  property AccessibleValue: TCaption; [rw]

  

The accessibility value for the control.

  property AccessibleRole: TLazAccessibilityRole; [rw]

  

The accessibility role for the control which classifies what kind of object in the class instance.

  property Action: TBasicAction; [rw]

  

The Action associated with the control.

  property Align: TAlign; [rw]

  

Specifies the placement of the control on its Parent control.

  property Anchors: TAnchors; [rws]

  

The set of anchor definitions for this control.

  property AnchorSide []: TAnchorSide; [r]

  

Array of anchor definitions, indexed by the control sides.

  property AutoSize: Boolean; [rw]

  

Allows automatic adjustment of the size for the control, according to its content.

  property BorderSpacing: TControlBorderSpacing; [rw]

  

Determines the inner and outer border spacing for this control.

  property BoundsRect: TRect; [rw]

  

The Top, Left and Bottom, Right for the control, in client coordinates.

  property BoundsRectForNewParent: TRect; [rw]

  

Temporary BoundsRect, used when the control e.g. is docked into a different Parent.

  property Caption: TCaption; [rws]

  

The text displayed for the control.

  property CaptureMouseButtons: TCaptureMouseButtons; [rws]

  

Indicates the mouse button(s) which are captured for the control.

  property ClientHeight: Integer; [rws]

  

The height for the client area on the control.

  property ClientOrigin: TPoint; [r]

  

Screen coordinates of the Top, Left pixel (in the client area) of the control.

  property ClientRect: TRect; [r]

  

Size of the client area for the control.

  property ClientWidth: Integer; [rws]

  

The width of the client area for the control.

  property Color: TColor; [rws]

  

The background color for the control.

  property Constraints: TSizeConstraints; [rw]

  

Contains the minimum and maximum Width and Height for the control.

  property ControlOrigin: TPoint; [r]

  

The top, left pixel for the control in screen coordinates.

  property ControlState: TControlState; [rw]

  

Contains state flags which indicate whether the control has been clicked, data is being read, or the control is being re-drawn, etc.

  property ControlStyle: TControlStyle; [rw]

  

Contains style flags which control the features or behaviors enabled for the control.

  property Enabled: Boolean; [rws]

  

Determines whether the control responds to mouse or keyboard input.

  property Font: TFont; [rws]

  

The font to be used for text display in this control.

  property IsControl: Boolean; [rw]

  

Not used in the current LCL implementation.

  property MouseEntered: Boolean; [r] deprecated ;

  

True when the mouse has entered the control. (Deprecated)

  property MouseInClient: Boolean; [r]

  

True when the mouse is in the client area for the control.

  property OnChangeBounds: TNotifyEvent; [rw]

  

Event handler signalled when the Bounds for the control have been changed.

  property OnClick: TNotifyEvent; [rw]

  

Notification handler for mouse clicks.

  property OnResize: TNotifyEvent; [rw]

  

Notification handler for a resize of the control.

  property OnShowHint: TControlShowHintEvent; [rw]

  

Event handler signalled when a hint window is displayed for the control.

  property Parent: TWinControl; [rw]

  

The control within which the control is shown.

  property PopupMenu: TPopupMenu; [rw]

  

A context-sensitive menu that pops up when the right mouse button is clicked over this control.

  property ShowHint: Boolean; [rws]

  

Enables Hint display for the control.

  property Visible: Boolean; [rws]

  

Allows the control, and all of its children, to be displayed or hidden.

  property WindowProc: TWndMethod; [rw]

  

The handler for all messages.

  property DockOrientation: TDockOrientation; [rw]

  

How the control is currently docked. (horizontally, vertically, in a notebook, or not at all).

  property Floating: Boolean; [r]

  

Determines whether the control is floating (not part of a form).

  property FloatingDockSiteClass: TWinControlClass; [rw]

  

The class for a floating host dock site for this control.

  property HostDockSite: TWinControl; [rw]

  

The host site (TWinControl) into which this control is docked. Nil if not docked.

  property LRDockWidth: Integer; [rw]

  

The Width when last docked with siblings to the left or right.

  property TBDockHeight: Integer; [rw]

  

The Height when last docked with siblings above or below.

  property UndockHeight: Integer; [rw]

  

Height for the control when undocked.

  property UndockWidth: Integer; [rw]

  

Width for the control when undocked.

  function UseRightToLeftAlignment; virtual;

  

True when BiDiMode is bdRightToLeft.

  function UseRightToLeftReading; virtual;

  

True when BiDiMode is not bdLeftToRight.

  function UseRightToLeftScrollBar;

  

True when BiDiMode indicates right-to-left reading is in use.

  function IsRightToLeft;

  

True when BiDiMode is not bdLeftToRight.

  property BiDiMode: TBiDiMode; [rws]

  

Indicates whether text controls use in bi-directional reading.

  property ParentBiDiMode: Boolean; [rw]

  

Indicates whether the BiDiMode settings in the Parent control are used.

published

  property AnchorSideLeft: TAnchorSide; [rw]

  

Contains anchor alignment information used to position the control with its left edge anchored to another control.

  property AnchorSideTop: TAnchorSide; [rw]

  

Contains anchor alignment information used to position the control with its top edge anchored to another control.

  property AnchorSideRight: TAnchorSide; [rw]

  

Contains anchor alignment information used to position the control with its right edge anchored to another control.

  property AnchorSideBottom: TAnchorSide; [rw]

  

Contains anchor alignment information used to position the control with its bottom edge anchored to another control.

  property Cursor: TCursor; [rw]

  

Contains the shape for the mouse pointer when the mouse is over the control.

  property Left: Integer; [rw]

  

The client coordinate with the left edge for the control.

  property Height: Integer; [rw]

  

The vertical size for the control.

  property Hint: TTranslateString; [rws]

  

The text to show in the Hint window for the control.

  property Top: Integer; [rw]

  

The client coordinate for the top edge of the control.

  property Width: Integer; [rw]

  

The horizontal size for the control.

  property HelpType: THelpType; [rw]

  

Indicates whether context-sensitive Help is selected by numeric ID or keyword.

  property HelpKeyword: string; [rws]

  

The context-sensitive Help keyword for the control.

  property HelpContext: THelpContext; [rws]

  

The numeric context-sensitive Help identifier for the control.

end;

Inheritance

TControl

  

The base class for visible controls.

|

TLCLComponent

  

The base class for LCL components which have an associated widget.

|

TComponent,IUnknown,IInterfaceComponentReference

|

TPersistent,IFPObserved

|

TObject

Description

TControl is a TLCLComponent descendant which implements the base class for visual controls in the LCL (Lazarus Component Library). TControl extends ancestor classes, like TLCLComponent and TComponent, with properties and methods needed to configure the appearance and behavior for the visual control and handle user interactions at run-time.

Some properties and methods are in all of its descendent classes. Others are implemented as needed in descendent classes. The properties and methods fall into categories like:

Applications do not normally create instances of TControl. It is used as an ancestor for descendent classes which implement additional features or behaviors.

TControl does not provide a window handle needed to draw the control in the underlying widgetset class. It includes a Parent property which is the windowed control where the control is hosted. It also provides the handle needed to draw the control.

Use TWinControl for a control which provides its own window handle.

See also

TWinControl

  

Implements a windowed control which can contain other child controls.

TLCLComponent

  

The base class for LCL components which have an associated widget.

TComponent


Version 3.2 Generated 2024-02-25 Home