Unit 'Controls' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#lcl]

TControl

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

The base class for visible controls.

Declaration

Source position: controls.pp line 1123

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;

  

  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;

  

Reacts on a change in the control's border spacing.

  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;

  

Message handler signalled when the mouse capture has been changed.

  procedure CMBiDiModeChanged(); message;

  

Message handler for BiDi mode changed.

  procedure CMSysFontChanged(); message;

  

Message handler for changed system Font.

  procedure CMEnabledChanged(); message;

  

Message handler for changed Enabled state.

  procedure CMHitTest(); message;

  

Message handler for hit test.

  procedure CMMouseEnter(); message;

  

Message handler for mouse entering the control.

  procedure CMMouseLeave(); message;

  

Message handler for mouse leaving the control.

  procedure CMHintShow(); message;

  

Message handler for hint display.

  procedure CMParentBiDiModeChanged(); message;

  

Message handler for parent control's BiDi mode changed.

  procedure CMParentColorChanged(); message;

  

Message handler for changed parent Color.

  procedure CMParentFontChanged(); message;

  

Message handler for changed parent Font.

  procedure CMParentShowHintChanged(); message;

  

Message handler for changed parent ShowHint.

  procedure CMVisibleChanged(); message;

  

Message handler for changed visibility.

  procedure CMTextChanged(); message;

  

Message handler for a text changed control message.

  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;

  

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

  function GetDragImages; virtual;

  

Get the list of images usable during dragging.

  function GetFloating; virtual;

  

Determines whether the control is floating.

  function GetFloatingDockSiteClass; virtual;

  

Returns the class for a floating host dock site.

  procedure BeforeDragStart; virtual;

  

Not implemented in TControl.

  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's 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;

  

Invokes the OnEndDock handler.

  procedure DoEndDrag(); virtual;

  

Invokes the OnEndDrag handler.

  procedure DoStartDock(); virtual;

  

Invokes the OnStartDock handler.

  procedure DoStartDrag(); virtual;

  

Invokes the OnStartDrag handler.

  procedure DragCanceled; virtual;

  

Notifies the control of a cancelled drag.

  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;

  

Invokes the OnMouseUp handler.

  procedure MouseEnter; virtual;

  

Invokes the OnMouseEnter handler.

  procedure MouseLeave; virtual;

  

Invokes the OnMouseLeave handler.

  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 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 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.

  function CanTab; virtual;

  

Determined 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;

  

Invokes the OnShowHint event handler.

  function DoMouseWheel(); virtual;

  

Invokes the OnMouseWheel handlers, when the wheel has been turned.

  function DoMouseWheelDown(); virtual;

  

Invokes the OnMouseWheelDown handler.

  function DoMouseWheelUp(); virtual;

  

Invokes the OnMouseWheelUp handler.

  function DoMouseWheelHorz(); virtual;

  

Performs actions needed to handle horizontal mouse wheel events.

  function DoMouseWheelLeft(); virtual;

  

Performs the OnMouseWheelLeft event handler.

  function DoMouseWheelRight(); virtual;

  

Performs the OnMouseWheelRight event handler.

  procedure VisibleChanging; virtual;

  

Notifies all OnVisibleChanging handlers.

  procedure VisibleChanged; virtual;

  

Notifies all OnVisibleChanged handlers.

  procedure EnabledChanging; virtual;

  

Notifies all OnEnabledChanging handlers.

  procedure EnabledChanged; virtual;

  

Notifies all OnEnabledChanged handlers.

  procedure AddHandler();

  

Adds an notification handler.

  procedure RemoveHandler();

  

Removes the given notification handler from the specified handler type.

  procedure DoCallNotifyHandler();

  

Invokes all notification handlers of the specified 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 back all sibling controls.

  class function GetControlClassDefaultSize; virtual;

  

Returns the default size for this class of controls (when added to a form).

  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();

  

Adjusts the height for a given Font to the specified pixels per inch (PPI).

  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 while the control is dragged.

  property DragKind: TDragKind; [rw]

  

The operation when the control is dragged - Drag or Dock.

  property DragMode: TDragMode; [rw]

  

Allows the user to drag the control.

  property MouseCapture: Boolean; [rw]

  

True when mouse messages are currently captured by this control.

  property ParentColor: Boolean; [rw]

  

Use the Color from the Parent control, when enabled.

  property ParentFont: Boolean; [rw]

  

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

  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]

  

The character string associated with 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 for double mouse clicks.

  property OnTripleClick: TNotifyEvent; [rw]

  

Event handler for triple mouse clicks.

  property OnQuadClick: TNotifyEvent; [rw]

  

Event handler for quadruple mouse clicks.

  property OnDragDrop: TDragDropEvent; [rw]

  

This handler determines the action on an drop onto this control, in a drag-drop operation.

  property OnDragOver: TDragOverEvent; [rw]

  

Event handler for a control being dragged over this control.

  property OnEndDock: TEndDragEvent; [rw]

  

Notification handler for the end of a docking operation.

  property OnEndDrag: TEndDragEvent; [rw]

  

Notification handler for the end of a drag operation.

  property OnMouseDown: TMouseEvent; [rw]

  

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

  property OnMouseMove: TMouseMoveEvent; [rw]

  

Event handler for mouse movement within 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 for downward movement of mouse wheel.

  property OnMouseWheelUp: TMouseWheelUpDownEvent; [rw]

  

Event handler for upward movement of the mouse wheel.

  property OnMouseWheelHorz: TMouseWheelEvent; [rw]

  

Event handler for horizontal movements of the mouse wheel.

  property OnMouseWheelLeft: TMouseWheelUpDownEvent; [rw]

  

Event handler signalled for left mouse wheel movements.

  property OnMouseWheelRight: TMouseWheelUpDownEvent; [rw]

  

Event handler signalled for right mouse wheel movements.

  property OnStartDock: TStartDockEvent; [rw]

  

Event handler for the start of a docking operation.

  property OnStartDrag: TStartDragEvent; [rw]

  

Event handler for the start of a dragging operation.

  property OnEditingDone: TNotifyEvent; [rw]

  

Event handler signalled when editing is done.

public

  FCompStyle: Byte;

  

Deprecated.

  procedure DragDrop(); virtual;

  

Invokes 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 the floating state.

  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 Parent, following same rules as for Align.

  procedure AnchorClient();

  

Anchor to Parent's full client area.

  function AnchoredControlCount;

  

The number of controls anchored to the current control.

  property AnchoredControls []: TControl; [r]

  

The list of controls which anchored to the current control.

  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();

  

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;

  

Update the base boundaries for the control; essential if there has been a lot of re-sizing.

  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 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.

  function Clone();

  procedure RemoveAllHandlersOfObject(); override;

  

  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 AddHandlerOnEnabledChanged();

  

Adds an OnEnabledChanged handler.

  procedure RemoveHandlerOnEnableChanging();

  

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.

  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: TGraphicsColor; [rws]

  

The background color of 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 of 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 aligment information used to position the control with its left edge anchored to another control.

  property AnchorSideTop: TAnchorSide; [rw]

  

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

  property AnchorSideRight: TAnchorSide; [rw]

  

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

  property AnchorSideBottom: TAnchorSide; [rw]

  

Contains anchor aligment 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: string; [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

  

|

TObject

Description

TControl is a TLCLComponent descendant which implements the base class for visual controls in the LCL (Typhon 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

  

TComponent



CT Web help

CodeTyphon Studio