This unit contains basic classes for visual controls. mrNone Series of constants to be used as respones in message boxes etc. mrNone=0 mrOK Series of constants to be used as respones in message boxes etc. mrOK=1 mrCancel Series of constants to be used as respones in message boxes etc. mrCancel=2 mrAbort Series of constants to be used as respones in message boxes etc. mrAbort=3 mrRetry Series of constants to be used as respones in message boxes etc. mrRetry=4 mrIgnore Series of constants to be used as respones in message boxes etc. mrIgnore=5 mrYes Series of constants to be used as respones in message boxes etc. mrYes=6 mrNo (not the same as mrNone) Series of constants to be used as respones in message boxes etc. mrNo=7 mrAll Series of constants to be used as respones in message boxes etc. mrAll=8 mrNoToAll Series of constants to be used as respones in message boxes etc. mrNoToAll=9 mrYesToAll Series of constants to be used as respones in message boxes etc. mrYesToAll=10 mrLast Series of constants to be used as respones in message boxes etc. mrLast=mrYesToAll=10 TWinControlClass - class of TWinControl TControlClass - class of TControl Date expressed in the encoded date-time type Time of day expressed in the encoded date-time type TCMMouseWheel - record holding data about the Mouse Wheel
Details held include:
          the Message associated with the wheel;
          the shift state (ie whether Shift, Alt, Control etc keys have been pressed);
          wheel data which can either be 
	  a position (X, Y coordinates) or 
	  a position plus an integer result.
TAlign - enumerated type listing the available options for aligning a Control Set of options of type TAlign defining possible ways of aligning Enumerated type listing the possible positions for alignment of a control

Enumerated type listing the possible positions for alignment of a control

akTop, 
  akLeft, 
  akRight, 
  akBottom
Set of possible anchor positions A string type for the caption of a control: may be translated TCursor - integer type defining range of values for cursor A subset of TFormBorderStyle, listing only the styles available to a control that is not a form Type defining the three mouse buttons (left, middle, right) crHigh - a cursor constant crDefault - cursor constant: use default cursor (0) crNone - a cursor constant: no cursor (-1) crArrow - cursor constant: Arrow cursor (-2) cursor constant crIbeam - cursor constant: shows I-beam cursor often used in text editors (-4) crSizeNESW - cursor constant: runs diagonally from NorthEast to SouthWest (-6) crSizeNS - cursor constant: cursur runs from North to South (-7) crNWSE - cursor constant: cursor runs from NorthWest to SouthEast crSizeWE - cursor constant: runs from West to East (-9) cursor constant crSizeN - cursor constant: cursor North (-24) crSizeNW - cursor constant: NorthWest (-23) cursor constant cursor constant crUpArrow - cursor constant: cursor is Up-Arrow (-10) crHourGlass - cursor constant: shows hour-glass (wait while action proceeds) (-11) crDrag - cursor constant: shows dragging cursor (-12) cursor constant cursor constant cursor constant crHandPoint - cursor constant: Pointing Hand (-21) TControlStyleType - enumerated type describing features of the Control
Enumerated type comprising:
    csAcceptsControls, // can have children in the designer
    csCaptureMouse,
    csDesignInteractive, // wants mouse events in design mode
    csClickEvents,
    csFramed,
    csSetCaption,
    csOpaque,
    csDoubleClicks,// control understands mouse double clicks
    csTripleClicks,// control understands mouse triple clicks
    csQuadClicks,  // control understands mouse quad clicks
    csFixedWidth,
    csFixedHeight, // control cannot change its height (for example combobox)
    csNoDesignVisible,
    csReplicatable,
    csNoStdEvents,
    csDisplayDragImage,
    csReflector,
    csActionClient,
    csMenuEvents,
    csNoFocus,
    csNeedsBorderPaint, // not implemented
    csParentBackground, // not implemented
    csDesignNoSmoothResize, // no WYSIWYG resizing in designer
    csDesignFixedBounds, // control can not be moved nor resized in designer
    csHasDefaultAction, // control implements useful ExecuteDefaultAction
    csHasCancelAction,   // control implements useful ExecuteCancelAction
    csNoDesignSelectable, // control can not be selected at design time
    csOwnedChildsSelectable // child controls owned by this control are selectable in the designer
As long as Name=Text, changing the Name will set the Caption When for example a button's Name and Caption have the value 'Button1' and the Name is changed to 'Button2' then the Caption is changed as well. When Name and Caption differs this flag has no effect. This flag has no effect during loading. Set of permissible control styles TControlStateType - an enumerated type listing the possible states (status) of Control

Enumerated type comprising

csLButtonDown,
    csClicked,
    csPalette,
    csReadingState,
    csAlignmentNeeded,
    csFocusing,
    csCreating,
    csPaintCopy,
    csCustomPaint,
    csDestroyingHandle,
    csDocking,
    csVisibleSetInLoading
Set of permissible Control States The base class for the canvas property of several graphic controls, such as TGraphicControl and TCustomControl TGraphicControl TCustomControl TCanvas CreateFont - creates font by calling inherited CreateFont TFPCustomCanvas.CreateFont Create - constructor for TControlCanvas: calls inherited Create then initialises local variables to show an empty control TFPCustomCanvas.create Destroy - destructor for TControlCanvas: frees handle and calls inherited Destroy TPersistent.Destroy TCanvas.Destroy The Control object for which this is the Canvas Reads or writes a flag to determine the identity of the Control object TDragImageList - a list of Images to be dragged cursor constant TDragObject - the base class for many objects that are designed to be dragged and dropped GetDragCursor - returns the cursor for use during dragging GetDragImages - returns a list of images for dragging Destroy this instance of TDragObject Assigns a particular source to this drag object Finds out a lot of information about the source object, such as its operating-system handle, size, position, how much the mouse is allowed to move before the object is moved, and whether the object is to be kept visible during the drag process. The object, with all its properties, that is to be dragged Find name of the object for dragging The object's name returned as a string Procedure for hiding the drag image during movement ShowDragImage // exist only for compatibility zero Procedure for keeping the image visible during movement HideDragImage Is this drag object being cancelled? Reads or sets flag to determine whether this drag image is being cancelled. Property has a boolean value, true if cancelling Finds Operating-System handle for this object Reads or writes flag for operating-system handle Find position for this object Reads or writes flag with position (as X, Y co-ordinates) The position of the taget control object to which the currect object is to be dragged Reads or writes flag with position (X, Y co-ordinates) of control object to which the current object is to be dragged The control object to which the current object is to be dragged (target) Reads or writes flag with identity of the target control object to which the currect object is to be dragged Has the drag object been dropped yet? Boolean property, true if the object has been dropped; reads or writes a flag with this information TDragObjectClass - class of TDragObject An ancestor class for many drag control objects Creates an instance of this object The control object that is to be dragged Reads or writes flag with identity of object for dragging Assigns source object Overrides definition in parent class The object that is to be dragged The identity of the control to be dragged Reads or writes flag with identity of control object TDragControlObject - a drag object that is a control TDragDockObject - a drag object that is destined for docking AdjustDockRect - adjust the position into which docking is to be performed DockRect - the rectangle within which docking is to occur DropAlign - the way in which the dropped object is to be aligned (top, left etc) DropOnControl - the control on which the dragged object is to be dropped Determines whether object is Floating or free (not attached to anything) A base class for managing the docking process

TDockManager is an abstract class for managing a dock site's docked controls.

The declaration contains a number of procedure definitions that are 'virtual' and 'abstract'. This means that there is no implementation specified: these essentially represent 'place-holders', and it is the responsibility of the developer of descendant classes to override these methods and implement them as desired.

BeginUpdate - start updating the dock process EndUpdate - finish updating the dock process GetControlBounds - finds the bounds of the control for docking InsertControl - insert the specified DropCtl into the nominated Control, using the alignment specified by InsertAt LoadFromStream - loads object for docking from a stream PaintSite - a handle for the site to be painted PositionDockRect method for determining the position ( DockRect) where the DropCtl is to be placed on the Client, aligned according to DropAlign RemoveControl - delete the specified control ResetBounds to their default values SaveToStream - saves the docking object to a stream SetReplacingControl - specify the control for replacing TSizeConstraints - limits that are set to determine the maximum and minimum values that can be used in sizing objects Method for achieving a Change in the constraints AssignTo - copies constraints to destination if it is of the same type and has different values, else calls inherited AssignTo TPersistent.AssignTo SetMaxHeight - specifies a maximum value for height SetMaxWidth - specifies a maximum value for width SetMinHeight - specifies a minimum value for height SetMinWidth - specifies a minimum value for width Create - constructor for TSizeConstraints: calls inherited Create and sets some default (zero) constraints TObject.Create UpdateInterfaceConstraints - updates the constraints on size for the Interface SetInterfaceConstraints - specifies the constraints for the interface EffectiveMinWidth - returns the effective value for minimum width, given the local and interface constraints EffectiveMinHeight - returns the effective value for minimum height, given the local and interface constraints EffectiveMaxWidth - returns the effective value for maximum width, given the local and interface constraints EffectiveMaxHeight - returns the effective value for maximum height, given the local and interface constraints MinMaxWidth the difference between Minimum and Maximum width MinMaxHeight the difference between Minimum and Maximum height MaxInterfaceHeight - the maximum height allowed by the interace MaxInterfaceWidth - the maximum width allowed by the interace MinInterfaceHeight - the minimum height allowed by the interface MinInterfaceWidth - the minimum width allowed by the interface The Control to which these constraints apply Options for determining constraints OnChange - event handler for a change in contraints MaxHeight - the maximum height MaxWidth - the maximum width MinHeight - the minimum height MinWidth - the minimum width TControlBorderSpacing - the spacing around a Control { TControlBorderSpacing defines the spacing around a control. The spacing around its children and between its children is defined in TWinControl.ChildSizing. Left, Top, Right, Bottom: integer; minimum space left to the autosized control. For example: Control A lies left of control B. A has borderspacing Right=10 and B has borderspacing Left=5. Then A and B will have a minimum space of 10 between. Around: integer; same as Left, Top, Right and Bottom all at once. This will be added to the effective Left, Top, Right and Bottom. Example: Left=3 and Around=5 results in a minimum spacing to the left of 8. InnerBorder: integer; This is added to the preferred size. For example: A buttons widget returns 75x25 on GetPreferredSize. CalculatePreferredSize adds 2 times the InnerBorder to the width and height. CellAlignHorizontal, CellAlignVertical: TControlCellAlign; Used for example when the Parents.ChildSizing.Layout defines a table layout. } Change - software emulation of the OnChange event Create - constructor for TControlBorderSpacing: sets some default positions, dimensions and alignments, then performs inherited Create

Create - constructor for TControlBorderSpacing: sets some default positions, dimensions and alignments, then performs inherited Create

Overrides ancestor constructors, and may be overridden

TObject.Create
Assign the contents of Source to the current control. If it is of the same type, copies selected spacing properties, otherwise calls inherited Assign TPersistent.Assign AssignTo - calls the Assign procedure for the Destination control TPersistent.AssignTo IsEqual - returns True if the specified spacing equals the current value GetSpaceAround - finds the space around the edge GetSpace - finds the space required by the specified Anchor kind The control for which border spacing is defined The kind of anchor to used in calculating spacing Event handler for a change in border spacing The size of the space at the left border The size of the space at the top border The size of the space at the right border The size of the space at the bottom border The size of the space all around the control TAnchorSide - the side on which anchoring is to be performed for the current control
TAnchorSide

    Class holding the reference sides of the anchors of a TControl.
    Every TControl has four AnchorSides:
    AnchorSide[akLeft], AnchorSide[akRight], AnchorSide[akTop] and
    AnchorSide[akBottom].
    Normally if Anchors contain akLeft, and the Parent is resized, the LCL
    tries to keep the distance between the left side of the control and the
    right side of its parent client area.
    With AnchorSide[akLeft] you can define a different reference side. The
    kept distance is defined by the BorderSpacing.
    
    Example1:
       +-----+  +-----+
       |  B  |  |  C  |
       |     |  +-----+
       +-----+

      If you want to have the top of B the same as the top of C use
        B.AnchorSide[akTop].Side:=asrTop;
        B.AnchorSide[akTop].Control:=C;
      If you want to keep a distance of 10 pixels between B and C use
        B.BorderSpacing.Right:=10;
        B.AnchorSide[akRight].Side:=asrLeft;
        B.AnchorSide[akRight].Control:=C;

      Do not setup in both directions, because this will create a circle, and
      circles are not allowed.
      
    Example2:
            +-------+
      +---+ |       |
      | A | |   B   |
      +---+ |       |
            +-------+
            
      Centering A relative to B:
        A.AnchorSide[akTop].Side:=arsCenter;
        A.AnchorSide[akTop].Control:=B;
      Or use this. It's equivalent:
        A.AnchorSide[akBottom].Side:=arsCenter;
        A.AnchorSide[akBottom].Control:=B;


Create - constructor for TAnchorSide: calls inherited Create, copies arguments to local variables and sets default anchor to Top TObject.Create GetSidePosition - returns the position of the side used for anchoring Assign - copies anchoring information from Source if it is of the same type as the current control, otherwise calls inherited Assign TPersistent.Assign Owner - the Control that owns the current control that is to be anchored The Kind of anchoring to be used The control whose anchoring properties are being determined The side on which anchoring is to be performed TControlActionLink - links the current control to an action

TControlActionLink - links the current control to an action

Defines a number of protected methods (inherited from TActionLink) for checking which parts of the control are linked to the action

Local variable that identifies the client control that is to be linked to the action IsOnExecuteLinked - returns True if the OnExecute event is linked DoShowHint - method to display hint; returns True if successful SetCaption - specifies the caption for the control TActionLink.SetCaption SetEnabled - specifies whether or not the link is enabled SetHint - specifies the string to use for the hint SetHelpContext - specifies the context-based help variable to use SetHelpKeyword - specifies the help keyword SetHelpType - specifies the type of help to use SetVisible - specifies the visiblity SetOnExecute - specifies the Execute event handler TControlActionLinkClass - class of TControlActionLink TControl - the main ancestor class for visual controls.

TControl is the main ancestor class for all visual controls.

The definition includes a large number of constants, types and methods that are inherited by derived classes and types.

These include devices for defining and controlling:

  • the state and position of the object (including alignment and anchoring),
  • the state of the mouse,
  • whether dragging or docked,
  • the size and type of border,
  • the way child components should behave,
  • the actions to be taken in response to various events,
  • and the way the Control should be drawn.

Properties defined here can be overridden by descendant classes.

TLCLComponent TComponent
Flag showing position of cursor Function to get text-string associated with control Uses RealGetText rather than GetTextBuf to avoid unnecessary read-writes to PChar buffers GetTextBuf The function returns the required text as a string Procedure to set the position of the cursor Stores text in buffer Uses RealSetText rather than SetTextBuf to avoid unnecessary read-writes to PChar buffer RealSetText SetTextBuf The text string to be stored in the buffer Procedure to set Visible flag and ensure the control can be seen Flag showing the set of states for this control Is autosizing proceeding? DoAutoSize - method for actually performing the AutoSize

TControl.DoAutoSize

IMPORTANT: Many Delphi controls override this method and many call this method directly after setting some properties.

During handle creation not all interfaces can create complete Device Contexts which are needed to calculate things like text size.

That's why you should always call AdjustSize instead of DoAutoSize.

AutoSize topic TControl.AdjustSize
AutoSizeCanStart - checks whether DoAutoSize is permitted to start

function TControl.AutoSizeCanStart: boolean;
  
  Returns true if DoAutoSize can start. That means, it tests the minimum
  requirements to start. Some controls need even more.

  It returns false if
  - AutoSize=false
  - or the control is currently autosizing
  - or the control is not visible
  - or the control is destroying

Procedure invoked when the anchor side is changed Set up the Align rules for this control Set the rules for anchoring this control Set the boolean variable that determines whether autosize can function Procedure invoked when bounds of the control are changed Procedure to execute a change in the control's constraints Procedure to execute a change in the control's border spacing Send a message to the system if the size and/or position of the control change Procedure for performing a resize within defined boundaries (constraints) CalculatePreferredSize - find default/preferred height and width

CalculatePreferredSize - find default/preferred height and width

procedure TControl.CalculatePreferredSize

(var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean);

Calculates the default/preferred width and height for a control, which is used by the LCL autosizing algorithms as default size. Only positive values are valid. Negative or 0 are treated as undefined and the LCL uses other sizes instead.

TWinControl overrides this and asks the interface for theme dependent values. See TWinControl.CalculatePreferredSize for more information.

WithThemeSpace: If true, adds space for stacking.

For example: TRadioButton has a minimum size. But for stacking multiple TRadioButtons there should be some space around. This space is theme dependent, so the parameter is passed to the widgetset.

Calls OnResize Calls the OnChangeBounds event handler Checks for changes and calls DoOnResize Smart calling Parent.AlignControls Update the basic boundaries of the control - essential if there has been a lot of re-sizing Lock the base bounds, so that they do not change even if surrounding controls are changed Unlock the base bounds so that they are free to change as surrounding controls are changed Update the rules for anchoring the control Procedure for altering the bounds of the control Perform the actual setting of the boundary rectangle Change the scale factor (multiplier or divider) for drawing the control Function to determine if autosizing is possible, and if so, gets the new width and height Try to set the automatic changed bounds
{ try to set the automatic changed bounds
  If the interface does not like our bounds, it sends a message with the real
  bounds, which invokes the automatic realigning of the control, .. a circle.
  To break the circle, only bounds that are different from the last try will
  be sent.
}
Find the origin (top left pixel) of the client control Visual size of client area Visual client area scrolled Gets the rectangular co-ordinates for a child control The function returns the coordinates of the child rectangle True if the rectangle is scrolled Find the offset for scrolling of the client Find the origin (top left pixel) of this control Protected messages to system - when left mouse button is down Protected messages to system - when right mouse button is down Protected messages to system - when middle button is down Protected messages to system - when left button is double-clicked Protected messages to system - when right button is double-clicked Protected messages to system - when middle button is double-clicked Protected messages to system - when left button is triple-clicked Protected messages to system - when right button is triple-clicked Protected messages to system - when middle button is triple-clicked Protected messages to system - when left button is quadruple-clicked Protected messages to system - when right button is quadruple-clicked Protected messages to system - when middle button is quadruple-clicked Protected messages to system - when mouse cursor has moved Protected messages to system - when left button is up Protected messages to system - when right button is up Protected messages to system - when middle button is up Protected messages to system - when the control is moved Protected messages to system - when control is sized Protected messages to system - when window position is changed LCL Message when capture method is changed Control Message when Enabled status is changed Control Message for Hit Test Control Message for entry of mouse Control Message for exit of mouse Control message for showing a hint Control Message for a change in parent colour Control Message for a change in parent hinting status Control Message for a change in visibility Calculate the sizes required for docking Create a floating dock site within the Bounds specified as an argument Find out which edge is used for docking (returned in Result) Find out (true or false) whether the control is floating (as opposed to fixed) Returns the class of the floating dock site Start the AutoDrag process Track the docking process when no target has been specified Perform the docking manoeuvre to the new dock site at the position specified by ARect DoDragMsg - sends a drag message at specified position for nominated object and target; returns an integer Result for success End the docking process End the dragging process Start the docking process DoStartDrag - start performing the drag DragCanceled - method for signalling that a drag is cancelled Drag the control over the source; Accept determines if the dragged object will be accepted PositionDockRect - place the nominated Drag-Dock object in the Rectangle SetDragMode - specify the mode for dragging Click - a procedure that allows the programmer to simulate a mouse click over the control, and initiates the same Action as that associated with the OnClick event DblClick - a procedure that allows the programmer to simulate a mouse double-click over the control, and initiates the same Action as that associated with the OnDblClick event TripleClick - a procedure that allows the programmer to simulate a mouse triple-click over the control, and initiates the same Action as that associated with the OnTripleClick event QuadClick - a procedure that allows the programmer to simulate a mouse quadruple-click over the control, and initiates the same Action as that associated with the OnQuadClick event MouseDown - a procedure that allows the programmer to simulate a mouse button being down over the control, and initiates the same Action as that associated with the OnMouseDown event

MouseDown - a procedure that allows the programmer to simulate a mouse button being down over the control, and initiates the same Action as that associated with the event

Button specifies which mouse button; Shift signifies whether Ctrl, Shift or Alt keys are also pressed; X, Y show mouse position

MouseMove - a procedure that allows the programmer to simulate a mouse being moved over the control, and initiates the same Action as that associated with the OnMouseMove event

MouseMove - a procedure that allows the programmer to simulate a mouse being moved over the control, and initiates the same Action as that associated with the event

Shift signifies whether Ctrl, Shift or Alt keys are also pressed; X, Y show mouse position

MouseUp - a procedure that allows the programmer to simulate a mouse button being Up over the control, and initiates the same Action as that associated with the OnMouseUp event

MouseUp - a procedure that allows the programmer to simulate a mouse button being Up over the control, and initiates the same Action as that associated with the event

Button specifies which mouse button; Shift signifies whether Ctrl, Shift or Alt keys are also pressed; X, Y show mouse position

MouseEnter - a procedure that allows the programmer to simulate a mouse entering the control, and initiates the same Action as that associated with the OnMouseEnter event MouseLeave - a procedure that allows the programmer to simulate a mouse leaving the control, and initiates the same Action as that associated with the OnMouseLeave event DialogChar - a LCL Key Message; returns True if a Dialog character has an associated message Changed - method to signal that a change has occured GetPalette - returns a handle to the palette for this control ChildClassAllowed - returns True if the specified class is allowed to be a child of this class Loaded - called when the component has finished loading. Calls inherited Loaded then copies various properties from client and parent TComponent.Loaded DefineProperties - declare any properties not specified elsewhere TComponent.DefineProperties TPersistent.DefineProperties AssignTo - if the Destination is a CustomAction, copies some specified properties to the Destination, otherwise calls inherited AssignTo

AssignTo - if the Destination is a CustomAction, copies some specified properties to the Destination, otherwise calls inherited AssignTo

The copied properties are:

  • Enabled
  • Hint
  • Caption
  • Visible
  • OnExecute (copied to OnClick)
  • HelpContext
  • HelpKeyword
  • HelpType
TPersistent.AssignTo
InvalidateControl - method to render the Control non-valid; visibility and opacity are specified InvalidateControl - method to render the Control non-valid; visibility and opacity are specified and instructions can be given to ignore Window Controls FontChanged - method for dealing with a changed font Find the action needed for operation of this control Function to get a text-string associated with the control This is the function that is actually used by GetTextBuf, and loads a string rather than performing read-write to a PChar buffer GetTextBuf RealSetText SetTextBuf The Function returns the required text as a string Procedure to store text associated with the control in a string This is the procedure that is actually used by SetTextBuf, and stores text as a string rather than performing read-write to a PChar buffer SetTextBuf RealGetText GetTextBuf The text-string that is to be stored Set up the action to be associated with this control Set up the colour to be used by the control Set up the flag to determine whether the control is to be enabled Set up the hinting pop-up for this control Set the name of the control Find who the parents are and store the information SetParentComponent - specify a new component to be the parent WndProc - message handler for the procedure of this window ParentFormHandleInitialized - called by ChildHandlesCreated of parent form

The form is a real connection to the target screen.

For example, the gtk under X gathers some screen information, but not before form creation.

But this information is needed to create DeviceContexts, which are needed to calculate Text Size and such stuff needed for AutoSizing.

That's why AdjustSize delays AutoSizing till this moment.

Now do the AutoSize.

CaptureChanged - the method for data capture has changed Notification - calls inherited Notification, then takes action depending on Operation

Notification - calls inherited Notification, then takes action depending on Operation

If Operation is removal, then nullifies any popupmenus or actions.

Disconnects all anchors.

TComponent.Notification
CanTab - if True, the Tab key can be used to navigate to this control GetDeviceContext - returns a device handle to correspond with the nominated WindowHandle GetEnabled - returns the Enabled status GetPopupMenu - returns a popup menu for use with this control DoOnShowHint - perform the code for the OnShowHint event handler VisibleChanging - method to use when the Visible property is changing AddHandler - add a control handler of the nominated type, using the specified method RemoveHandler - remove a control handler of the nominated type, using the specified method DoContextPopup - perform the action to display a context-sensitive popup window, at the specified mouse position GetActionLinkClass - returns the class of the action link ActionChange - method for changing an action Link to the default action associated with this control Whether auto-size is to be used

// standard properties, which should be supported by all descendants

AutoSize permits the size of a control to be adjusted automatically, for example a button can become bigger or smaller to accommodate a longer or shorter caption.

Reads logical (boolean) flag to see whether auto-sizing is to be operated, or writes the flag to say it should be done. Default is false, ie no auto-sizing

Autosize topic
Ctl3D - retained for Delphi compatibility; even there it is deprecated DragCursor - the style of cursor to be used during the Drag process DragKind - what sort of dragging? Drag or Dock DragMode - whether manual or automatic Is the mouse position captured? ParentFont - should the control use the same font as the parent? Default is true ParentColor - should the control have the same colour as the parent? Default is true ParentShowHint - does the control adopt the same hinting behaviour as its parent? Default is true The stored (saved) properties of the current session, expressed as a string Text - the character string in the name or caption of the control

Text - the character string in the name or caption of the control

But BEWARE: Text is used in another context in editing controls such as TEdit and TCustomEdit, TLabeledEdit and TCustomLabeledEdit, where it contains the character string that is being edited in the Edit Box.

Event Handler for constrained resize

Event handler needs to be supplied to cover the need to resize a control within the given constraints of maximum and minimum width and height

Event handler to supply information when a context-sensitive pop-up menu is required Event Handle for mouse double-click

Double-clicking is much more common in a Windows environment than in Unix or Linux, where single-clicking is the default method for selecting an object. However, in all environments there could be valid use for a double-click, and a method should be supplied if appropriate.

Event handler for mouse triple-click Event handler for quadruple click Event handler for the Drag-Drop manoeuvre Event handler for the case when a control is dragged over another control Event handler for the end of a docking manoeuvre Event handler for the end of a dragging process Event handler for when a mouse button is pressed down Event handler for mouse movement within the current control Event handler for when the mouse button is released, ie "up" Event handler for when the mouse enters the area of the current control Event handler for when the mouse leaves the area of the current control Event handler for the start of a docking manoeuvre Event handler for start of dragging process Event handler when editing is done FCompStyle - deprecated
// DEPRECATED. Enables (valid) use of 'IN' operator (this
      // is a hack for speed. It will be replaced by the use of the widgetset
      // classes.
      // So, don't use it anymore.        
DragDrop - Procedure to govern Dragging/Dropping of control The object to be dragged and dropped The X co-ordinate to which the object is to be dropped (target) The Y co-ordinate to which the object is to be dropped (target) Dock - Procedure governing Docking of Control

Dock - Procedure governing Docking of Control

Performs checks that there is already a valid host control to which the present control is to be docked, removes old controls from the list of docked controls and adds the new control to the list, then calls DoDock to perform the actual docking process

An exception is raised if there is already a docking process in progress for this control
The host control to which which the current control is to be docked The position at which the control is to be docked ManualDock - permits operator-defined docking

Docks this control to DropControl or on NewDockSite.

If DropControl is not nil, ControlSide defines on which side of DropControl this control is docked. (alNone,alClient for stacked in pages). DropControl will become part of a TDockManager.

If DropControl is nil, then DropControl becomes a normal child of NewDockSite and ControlSide is ignored.

The function returns True if a manual dock has been successfully performed The new site to which the control is docked, if DropControl has been found to be nil If nil (default) then ignored else used as the control for docking, on side specified by ControlSide The side on which the control is to be docked, if DropControl is not nil ManualFloat - the opposite of ManualDock, allows operator to Float a control
function TControl.ManualFloat(TheScreenRect: TRect;
    KeepDockSiteSize: Boolean = true): Boolean;

  Undock and float.
  Float means here: create the floating dock site and dock this control into it.
  Exception: Forms do not need float dock sites and float on their own.

The function returns True if a manual float has been succesfully performed The rectangle within which the floating control is located The rectangle within which the floating control is located
(ie the location of the floating dock site to which the control is docked)
Remove a previously docked control and put a new control in its place Checks to see whether there is a previously docked control,
and removes it, then puts the new control in its place
ManualDock
Returns True if a docked control has been successfully replaced with a new one The old control that was previously docked at this site The new site for docking; used if DropControl is nil The control site to be used for docking, unless it is nil when it is igored. Passed straight through as an argument to ManualDock The side to which the new control is to be aligned; passed straight through as an argument to ManualDock Returns True if the control is being dragged Returns True if the control is being dragged AdjustSize - Smart way to DoAutoSize

TControl.AdjustSize calls DoAutoSize in a smart fashion.

During loading and handle creation the calls are delayed.

This method initially does the same as TWinControl.DoAutoSize. But since DoAutoSize is commonly overriden by descendant components, it is not useful to perform all tests, which can result in too much overhead. To reduce this the LCL calls AdjustSize instead.

AutoSize topic
Auto-sizing has been delayed until some other process is complete Returns True if auto-sizing has been delayed AnchorToNeighbour - anchoring instructions
{------------------------------------------------------------------------------
  procedure TControl.AnchorToNeighbour(Side: TAnchorKind; Space: integer;
    Sibling: TControl);

  Setup AnchorSide to anchor one side to the side of a neighbour sibling.
  For example Right side to Left side, or Top side to Bottom.
 ------------------------------------------------------------------------------}
The side on which we should anchor The size of the space to be left around the control when anchoring The sibling control to which we should anchor AnchorParallel - instructions for anchoring beside another control

AnchorParallel - instructions for anchoring beside another control

Sibling - another control beside which the current control is to be anchored

The side on which we should anchor to the sibling The size of the space to be left around the control when anchoring The sibling control to which we should anchor in a parallel manner AnchorHorizontal - instructions for anchoring Another control to which the current control is to be anchored, centred horizontally AnchorVertical - instructions for anchoring Another control to which the current control is to be anchored, centred vertically SetBounds - set the bounds (top. left, height, width) for the window The X co-ordinate of the top left pixel of the control The Y co-ordinate of the top left pixel of the control The width of the control The height of the control Sets the bounds of the control initially, when it is created Checks that this is a new control, then calls SetBounds to set up coordinates defining its position SetBounds X co-ordinate of top left pixel Y co-ordinate of top left pixel Width of control Height of control Set the bounds, keeping the base values Returns default/preferred height and width, to be used in autosizing algorithms

GetPreferredSize - find default/preferred height and width

procedure TControl.GetPreferredSize 
        (var PreferredWidth, PreferredHeight: integer; 
          WithThemeSpace: Boolean);

Returns the default/preferred width and height for a control, which are used by the LCL autosizing algorithms as default size. Only positive values are valid. Negative or 0 are treated as undefined and the LCL uses other sizes instead.

WithThemeSpace: If true, adds space for stacking.

For example: TRadioButton has a minimum size. But for stacking multiple TRadioButtons there should be some space around. This space is theme dependent, so the parameter is passes to the widgetset

TWinControl overrides this and asks the interface for theme dependent values. See TWinControl.CalculatePreferredSize for more information.

Render the preferred size no longer valid (implies that we will look for another)

Create a new Control - Constructor. Overrides constructors of ancestor classes and sets a number of defaults. Often overridden by descendant classes.

Defaults set by the Constructor include ControlStyle, Constraints, BorderSpacing, Anchoring, alignment, CaptureMouseBottons, Color, Visibility, Hinting, Cursor, Font, The WindowProcedure to be used, the Help type, the FloatingDockSite and Enabled properties

TComponent.Create TLCLComponent.Create Create - constructor for TControl and derived classes: calls inherited Create and sets a number of defaults

Destructor for Control. Detaches control from parents, removes graphics, frees memory and Operating System handles, pointers etc.

Overrides destructors of ancestor classes, and in turn may be overridden by descendant classes.

TComponent.Destroy TLCLComponent.Destroy Destroy - Destructor for TControl. Detaches control from parents, removes graphics, frees memory and Operating System handles, pointers etc
EditingDone - what to do when you have finished editing; calls the OnEditingDone event handler if assigned

TControl.EditingDone

Called when user has finished editing. This procedure can be used by data links to commit the changes.

For example:

  • When focus switches to another control (default)
  • When user selected another item

It's totally up to the control, what events will commit.

What to do when the RETURN button is pressed, signifying default action What to do when ESCAPE is hit (or the CANCEL button is selected) - signifying CANCEL BeginDrag - starts the dragging of a control
{------------------------------------------------------------------------------
  Method: TControl.BeginDrag
  Params: Immediate: Drag behaviour
          Threshold: distance to move before dragging starts
                     -1 uses the default value of Mouse.DragThreshold
  Returns: Nothing

  Starts the dragging of a control. If the Immediate flag is set, dragging
  starts immediately.
 ------------------------------------------------------------------------------}
If True, start drag as soon as cursor starts to move Least value for movement of cursor before drag starts BeginDrag - starts the dragging of a control. In this version BringToFront applies If True, start drag as soon as cursor starts to move Bring the control to the front of the viewed screen Returns True if Colour is stored Function returns True if colour has been stored HasParent - returns True if there is a parent component responsible for streaming

HasParent - returns True if there is a parent component responsible for streaming

This function will be called during streaming to decide if a component has to be streamed by its owner or parent

TComponent.HasParent
Function returns True if there is a parent This control is the parent of another (specified) control

This control is the parent of another control.

AControl: the control of which this is a parent.

Result: true if this is a parent

Function returns True if this control is a parent, ie there is a child control The control of which this control is a parent (ie the Child control) Returns True if the control is visible on the current desktop

The control is visible on the current desktop

Checks parents too

Function returns True is control is visible Hide this control Refresh the data on this control Repaint the control, ie refill its canvas Render this control non-valid Function checks whether a particular child class is allowed Function returns True if child class has been checked and is allowed The child class which is being checked to see whether it is allowed Boolean set to True if a non-valid class is found and an exception has been raised Checks a new parent for this control The new parent associated with this control Send to back, ie place this control behind all other controls in the current screen; it will not be visible unless the controls in front are transparent SetTempCursor - set a temporary cursor The temporary cursor which has been set Update the roles for this form; see whether there have been any changes in its role Gets text associated with the control from a buffer
* The VCL implementation relies on the virtual Get/SetTextBuf to 
 * exchange text between widgets and VCL. This means a lot of 
 * (unnecesary) text copies.
 * The LCL uses strings for exchanging text (more efficient).
 * To maintain VCL compatibility, the virtual RealGet/SetText is
 * introduced. These functions interface with the LCLInterface. The
 * default Get/SetTextbuf implementation calls the RealGet/SetText.
 * As long as the Get/SetTextBuf isn't overridden Get/SetText 
 * calls RealGet/SetText to avoid PChar copying.
 * To keep things optimal, LCL implementations should always 
 * override RealGet/SetText. Get/SetTextBuf is only kept for
 * compatibility.
RealGetText GetText
Pointer to the buffer containing the text Pointer to the buffer containing the string Length of the buffer Get the length of the specified text Stores text associated with the control in a buffer
* The VCL implementation relies on the virtual Get/SetTextBuf to 
 * exchange text between widgets and VCL. This means a lot of 
 * (unnecesary) text copies.
 * The LCL uses strings for exchanging text (more efficient).
 * To maintain VCL compatibility, the virtual RealGet/SetText is
 * introduced. These functions interface with the LCLInterface. The
 * default Get/SetTextbuf implementation calls the RealGet/SetText.
 * As long as the Get/SetTextBuf isn't overridden Get/SetText 
 * calls RealGet/SetText to avoid PChar copying.
 * To keep things optimal, LCL implementations should always 
 * override RealGet/SetText. Get/SetTextBuf is only kept for
 * compatibility.
RealSetText SetText
Pointer to the buffer where the text is to be stored Perform an Action specified by the message and parameters Adjust from Screen co-ordinates to Client-relative co-ordinates Convert from Client co-ordinates to Screen co-ordinates Adjust from Screen co-ordinates to Control-relative co-ordinates Convert from control-relative co-ordinates to absolute screen co-ordinates Makes the control visible. Perform the Update method specified by the parent control (if there is one) SetZOrder - specify this control's place in the Z-order (ie front-to-back) of controls HandleObjectShouldBeVisible - returns True if the Handle Object is required to be visible ParentHandlesAllocated - returns True if the parent handles have been allocated InitiateAction - method to start the action associated with this control AddHandlerOnResize - method for adding a handler for the OnResize event RemoveHandlerOnResize - method for removing a handler for the OnResize event AddHandlerOnChangeBounds - method for adding a handler for the OnChangeBounds event RemoveHandlerOnChangeBounds - method to remove a handler for the OnChangeBounds event The action to be associated with this control

// standard properties, which should be supported by all descendants

The (default) action to be associated with this control

Can either read the action already associated with the control (GetAction), or write an action to be associated (SetAction)

Used to align the control to the top, bottom, left or right of its client.

// standard properties, which should be supported by all descendants

Either reads a flag containing alignment instructions (FAlign) or writes alignment instructions (SetAlign)

May have no alignment, may have custom or client alignment, or can be aligned to top, bottom, left or right

TAlign
The set of anchor definitions for this control

// standard properties, which should be supported by all descendants

Determines how the control is to be anchored to its client or parent conrol

Either reads a flag containing the set of anchors to be used, or writes a set of anchors. If they have been written, this is indicated in IsAnchorsStored

Finds which side to use for anchor

// standard properties, which should be supported by all descendants

Finds which side is to be used to anchor this control, and what relationships it has to other controls nearby.

For complex relationships, use the Side property of the parent class TAnchorSide, and make a reference eg using asrCenter

Determines the border spacing for this control

// standard properties, which should be supported by all descendants

Determines the border spacing for this control

Reads flag to find stored spacing values required for the border of the control, or writes the flag to set the spacing.

The properties are defined in the parent class TControlBorderSpacing

Determines the rectangle bounding this control

// standard properties, which should be supported by all descendants

Finds the values for the bounding rectangle, or sets the values.

Bounding rectangle (top-left, bottom-right) is defined in TRect

BoundsRectForNewParent - finds (or sometimes specifies) the bounding rectangle for a new parent control // standard properties, which should be supported by all descendants Caption - the text-string appearing on the Control, usually used to identify its function

Gets caption as a text-string (GetText), or stores the new caption (SetText). Shows flag if caption is stored (IsCaptionStored).

By default, the Caption appears the same as the control Name in the Object Inspector, and the developer needs to set it explicitly to some new text.

The VCL implementation relies on the virtual Get/SetTextBuf to exchange text between widgets and VCL. This means a lot of (unnecesary) text copies.

The LCL uses strings for exchanging text (more efficient). To maintain VCL compatibility, the virtual RealGet/SetText is introduced. These functions interface with the LCLInterface.

The default Get/SetTextBuf implementation calls the RealGet/SetText. As long as the Get/SetTextBuf isn't overridden Get/SetText calls RealGet/SetText to avoid PChar copying.

To keep things optimal, LCL implementations should always override RealGet/SetText. Get/SetTextBuf is only kept for compatibility.

ClientHeight - determines the height of the client within which the control exists

// standard properties, which should be supported by all descendants

Finds or sets the client height, and sets a flag if it has been stored

ClientOrigin - Top left pixel of the client within which the control exists

// standard properties, which should be supported by all descendants

Finds origin of client (read-only)

ClientRect - finds the position of the rectangle for the client within which the control exists

// standard properties, which should be supported by all descendants

ClientRect - finds the coordinates of the rectangle for the client within which the control exists (read-only)

ClientWidth - determines the width of the client within which the control exists

// standard properties, which should be supported by all descendants

ClientWidth - determines the width of the client within which the control exists; reads the width of the client control or sets the value. Sets flag if value is stored

Determine the colour for the current control

// standard properties, which should be supported by all descendants

Reads the value for colour, or stores the value, and sets a flag if the colour is stored.

The default colour is the same as the window in which the control is located.

Determine Constraints (max and min height and width) for this control

// standard properties, which should be supported by all descendants

Determine Constraints (max and min height and width) for this control; reads the size constraints or stores new ones.

ControlOrigin - top left pixel of this control

// standard properties, which should be supported by all descendants

Reads value for the Origin (top left pixel) of this control. (read-only)

ControlState - whether mouse has been clicked, data being read, control being re-drawn, etc

// standard properties, which should be supported by all descendants

ControlState - whether mouse has been clicked, data being read, control being re-drawn, etc. Reads or stores the state of the control.

ControlStyle - whether the control responds to mouse clicks, can be re-sized, has particular actions, etc

// standard properties, which should be supported by all descendants

ControlStyle - whether the control responds to mouse clicks, can be re-sized, has particular actions, etc. Reads the stored style, or saves the new style

Whether the control is Enabled. If not, it usually appears 'greyed-out'

// standard properties, which should be supported by all descendants

Whether the control is Enabled. If not, it usually appears 'greyed-out'

Reads a flag to see whether the control is enabled, or stores a new value. If stored, sets a flag to say so.

The Font to be used for text in this control

// standard properties, which should be supported by all descendants

Reads a flag to see what font should be used, or sets a flag to store it. If stored, sets a flag to say so

The properties of Font are defined in the parent class TFont

Reads or writes a flag to deterine whether this object is actually a control // standard properties, which should be supported by all descendants
Reads a logical (boolean) flag or sets it to determine whether this object is a control.
Reads a flag to determine whether the mouse entered the control // standard properties, which should be supported by all descendants
Reads logical (boolean) flag to see whether mouse has entered the control
Event handler for a change in bounds of the control

// standard properties, which should be supported by all descendants

Reads or Writes flag if bounds are changed

Event Handler for mouse click

// standard properties, which should be supported by all descendants

This is often the default action for many controls, and is often the ONLY action specified by the programmer. The action can be spcified by the user, either by typing explicit code into the implementation section for this control, or by selecting an action from a pre-supplied ActionList

Reads or writes a flag if a mouse click is detected, and sets a flag if a value is stored.

Event Handler for resize of control This event is triggered whenever the Width, Height, ClientWidth or ClientHeight of the control has changed. During autosize the size can change multiple times and only the last change triggers the OnResize. Use OnResize to react to resizes or to put your custom aligning, positioning code into this. To react to moves use the OnChangeBounds event. Common mistake: Keep in mind that ClientWidth and ClientHeight can change even when Width, Height stays the same. For example when the theme or the font changes the Width, Height of a TForm, TGroupBox, TPageControl stays, but the frame changes and thus the ClientWidth, ClientHeight too. This does not happen that often under windows, but it happens quite often on other platforms. Especially it is not sufficient to write only a TForm.OnResize handler to resize all controls on the form. This is a common bug in Delphi applications. Event Handler when a hint needs to be shown // standard properties, which should be supported by all descendants
Reads or Writes a flag when a hint (a small pop-up box, appearing when the mouse hovers over an object) is to be shown
Determine what is the parent for this control // standard properties, which should be supported by all descendants
Reads or writes a flag to find or store the identity of the parent for this control. The parent is of type TWincontrol
PopupMenu - a context-sensitive menu that pops up when the right mouse button is clicked over this control // standard properties, which should be supported by all descendants
Reads the details of the pop-up menu, or stores them.
Properties are defined in the parent class TPopupMenu
Flag to determine: Is hint to be displayed for this control? // standard properties, which should be supported by all descendants
Reads flag or writes one to determine if a hint is to be shown when mouse hovers over this control. If value is stored, a storage flag is set. Display of the actual hint is controlled by OnShowHint
OnShowHint
Visible - can the control be seen?
The Visible property represents the ability to see a visual control. 
          If Visible is True the control is shown, otherwise it is hidden.
          Calling Show sets, among others, Visible to True.
          Setting Visible to False is equivalent to calling Hide method.
The Visible property does not depend on control's parent visibility. Use IsVisible method to consider this and get real visibility.
Reads or writes a message associated with this window // standard properties, which should be supported by all descendants
Reads message from flag area, or stores a message
TWndMethod TLMessage
DockOrientation - whether docking is oriented horizontally, vertically, according to pages or not at all Whether the control is Floating (as opposed to Docked) FloatingDockSiteClass - reads or writes the class of the floating dock site HostDockSite - the host site to which this control is docked LRDockWidth - the docked width from left to right TBDockHeight - the docked height from top to bottom UndockHeight - the height of the undocked control UnDockWidth - the undocked width of the control Anchor to the left side Anchor to the Top Anchor to the right side Anchors to the bottom The type of cursor to be used with this control Left - the coordinate of the left edge of the control Height - the vertical dimension of the control Hint - a small informative pop-up box that appears when the mouse 'hovers' over a control

Hint - a small informative pop-up box that appears when the mouse 'hovers' over a control

Requires ShowHint to be True

Top - the coordinates of the top edge of the control Width - the horizontal dimension of the control The type of help to be used with this control - keyword or context The keyword to be used for Help in this control The context-sensitive help message to be used with this control Integer type defining width of the border of a control How Child controls are to be sized relative to parent { TControlChildSizing } { LeftRightSpacing, TopBottomSpacing: integer; minimum space between left client border and left most children. For example: ClientLeftRight=5 means child's Left position is at least 5. HorizontalSpacing, VerticalSpacing: integer; minimum space between each child horizontally } { Defines how child controls are resized/aligned. cesAnchorAligning, cssAnchorAligning Anchors and Align work like Delphi. For example if Anchors property of the control is [akLeft], it means fixed distance between left border of parent's client area. [akRight] means fixed distance between right border of the control and the right border of the parent's client area. When the parent is resized the child is moved to keep the distance. [akLeft,akRight] means fixed distance to left border and fixed distance to right border. When the parent is resized, the controls width is changed (resized) to keep the left and right distance. Same for akTop,akBottom. Align=alLeft for a control means set Left leftmost, Top topmost and maximize Height. The width is kept, if akRight is not set. If akRight is set in the Anchors property, then the right distance is kept and the control's width is resized. If there several controls with Align=alLeft, they will not overlapp and be put side by side. Same for alRight, alTop, alBottom. (Always expand 3 sides). Align=alClient. The control will fill the whole remaining space. Setting two children to Align=alClient does only make sense, if you set maximum Constraints. Order: First all alTop children are resized, then alBottom, then alLeft, then alRight and finally alClient. cesScaleChilds, cssScaleChilds Scale children, keep space between them fixed. Children are resized to their normal/advised size. If there is some space left in the client area of the parent, then the children are scaled to fill the space. You can set maximum Constraints. Then the other children are scaled more. For example: 3 child controls A, B, C with A.Width=10, B.Width=20 and C.Width=30 (total=60). If the Parent's client area has a ClientWidth of 120, then the children are scaled with Factor 2. If B has a maximum constraint width of 30, then first the children will be scaled with 1.5 (A.Width=15, B.Width=30, C.Width=45). Then A and C (15+45=60 and 30 pixel space left) will be scaled by 1.5 again, to a final result of: A.Width=23, B.Width=30, C.Width=67 (23+30+67=120). cesHomogenousChildGrowth, cssHomogenousChildDecrease Enlarge children equally. Children are resized to their normal/advised size. If there is some space left in the client area of the parent, then the remaining space is distributed equally to each child. For example: 3 child controls A, B, C with A.Width=10, B.Width=20 and C.Width=30 (total=60). If the Parent's client area has a ClientWidth of 120, then 60/3=20 is added to each Child. If B has a maximum constraint width of 30, then first 10 is added to all childs (A.Width=20, B.Width=30, C.Width=40). Then A and C (20+40=60 and 30 pixel space left) will get 30/2=15 additional, resulting in: A.Width=35, B.Width=30, C.Width=55 (35+30+55=120). cesHomogenousSpaceGrowth Enlarge space between children equally. Children are resized to their normal/advised size. If there is some space left in the client area of the parent, then the space between the children is expanded. For example: 3 child controls A, B, C with A.Width=10, B.Width=20 and C.Width=30 (total=60). If the Parent's client area has a ClientWidth of 120, then there will be 60/2=30 space between A and B and between B and C. } Change - software emulation of the OnChange event Create - constructor for TControlChildSizing: performs inherited Create then sets some default alignments and sizes

Create - constructor for TControlChildSizing: performs inherited Create then sets some default alignments and sizes

Overrides ancestors, may be overridden

TObject.Create
Assign - if source is the same type as current control, copies a large number of explicit properties from source, else calls inherited Assign TPersistent.Assign AssignTo - calls the Assign method for the destination control TPersistent.AssignTo IsEqual - returns True if the specified sizing is the same as the current value The Control to which childsizing is to be applied OnChange - event handler for a chaange in sizing EnlargeHorizontal - make larger in the horizontal plane EnlargeVertical - make larger in the vertical plane ShrinkHorizontal - make smaller in the horizontal plane ShrinkVertical - make smaller in the vertical plane LeftRightSpacing - spacing from left to right TopBottomSpacing - spacing from top to bottom HorizontalSpacing - spacing in the horizontal plane VerticalSpacing - spacing in the vertical plane TWinControlActionLink - same as TControlActionLink TWinControlActionLinkClass - class of TWinControlActionLink TWinControl - the base class for all windowed controls

Defines many of the properties inherited by child classes, particularly those related to size, position, bounds, docking, the responses to mouse movements and key presses.

Defines procedures and functions related to windowed controls, some of which override virtual methods defined in ancestor classes.

TControl
FWinControlFlags - local variable to hold status flags AdjustClientRect - method for adjusting the size and position of the client control AlignControls - align the specified control with a given client rectangle DoAlignChildControls - method for aligning child controls from a list; returns True if successful DoChildSizingChange - method for changing size of a child component DoDragMsg - issues a Drag message for a nominated drag object at a specified position, to a specific target with ADocking set True or False; returns an integer result CMShowingChanged - control message when Showing property is changed CMVisibleChanged - control message when Visible property is changed This component contains a specified control ControlsAligned - called by AlignControls after aligning controls DoSendBoundsToInterface - sends information about the control's bounds to the interface RealizeBounds - checks for changes and calls DoSendBoundsToInterface CreateSubClass - creates a sub-class using the supplied parameters DoSetBounds - anticipate the new clientwidth/height and call inherited method

TWinControl DoSetBounds

Params: ALeft, ATop, AWidth, AHeight : integer

Anticipate the new clientwidth/height and call inherited method

Normally the clientwidth/clientheight is adjusted automatically by the interface. But it is up to interface when this will be done. The gtk for example just puts resize requests into a queue. The LCL would resize the child components just after this procedure due to the clientrect. On complex forms with lots of nested controls, this would result in thousands of resizes.

Changing the clientrect in the LCL to the most probable size reduces unneccessary resizes.

Control.DoSetBounds
DoAutoSize - performs a lot of calculations and adjustments of child components in the window before automatically adjusting the size of the window itself

  • Checks whether Autosize is in fact permitted
  • Checks for unaligned child components and fits them in as best it can
  • Moves the constrained (aligned) child components to the correct position
  • Adjusts the size of the client rectangle
  • Adjusts the bounds of the whole control

Because this method involves so much overhead, the simpler TControl.AdjustSize is often called instead.

TControl.DoAutoSize
CalculatePreferredSize - calculates the default/preferred width and height for a TWinControl, which is used by the LCL autosizing algorithms as default size

procedure TWinControl.CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean);

Calls the inherited method to calculate the default/preferred width and height for a TWinControl, which is used by the LCL autosizing algorithms as default size. Only positive values are valid. Negative or 0 are treated as undefined and the LCL uses other sizes instead.

TWinControl overrides this:

  • If there are child components, their total preferred size is calculated
  • If this value can not be computed (e.g. the children depend too much on their parent clientrect), then the interface is asked for the preferred size

For example the preferred size of a TButton is the size, where the label fits exactly. This depends heavily on the current theme and widgetset.

This value is independent of constraints and siblings, only the inner parts are relevant.

WithThemeSpace: If true, adds space for stacking. For example: TRadioButton has a minimum size. But for stacking multiple TRadioButtons there should be some space around. This space is theme dependent, so it is passed as a parameter to the widgetset.

TControl.CalculatePreferredSize
GetChildren - makes a list of all the child components for this control TComponent.GetChildren ChildClassAllowed - returns True if the given child class is permitted PaintControls - method for painting a series of controls PaintHandler - message handler for painting PaintWindow - method for painting a window CreateBrush - method to create a brush for painting CMEnabledChanged - control message for a change in the Enabled property CMShowHintChanged - control message for a change in the ShowHint property WMEraseBkgnd - LCL message for erasing background WMNotify - LCL Notify message WMSetFocus - LCL Message to set focus WMKillFocus - LCL Message to kill focus WMShowWindow - LCL Message to show window WMEnter - LCL Message for entry to the control WMExit - LCL Message for exit from control WMKeyDown - LCL Message for a key down WMSysKeyDown - LCL Message for a system key down WMKeyUp - LCL Message for a key up WMSysKeyUp - LCL Message for a system key up WMChar - LCL Message signifying a character WMSysChar - LCL Message signifying a system character WMPaint - LCL Message for Paint WMDestroy - LCL Message for control destruction WMMove - LCL Message for movement WMSize - LCL Message for sizing control CNKeyDown - control message for key down CNSysKeyDown - control message for system key down CNKeyUp - control message for key up CNSysKeyUp - control message for system key up CNChar - control message specifying a character DoAddDockClient - add the specified control as a client for docking in the specified location (Arect) DockOver - software emulation of the OnDockOver event DoDockOver - perform the DockOver method DoRemoveDockClient - method for removing a docking client DoUnDock - software emulation of the OnUnDock evnet GetSiteInfo - software emulation of the OnGetSiteInfo event ReloadDockedControl - load the docked control again (it may have become misaligned during other processes) CreateDockManager - returns a new Dock Manager DoEnter - perform the action for the OnEnter event handleer DoExit - perform the action for the OnExit event handler DoKeyDownBeforeInterface - issues a message to the interface and returns True if a key was already down DoRemainingKeyDown - issues a LCL message and returns True if a key remains down DoRemainingKeyUp - issues a LCL message and returns True if a key remains up DoKeyPress - issues a LCL message and returns True if a key is pressed DoUTF8KeyPress - issues a LCL message and returns True if there has been a UTF8 key press DoKeyUpBeforeInterface - issues an interface message and returns True if a key was already up ChildKey - LCL message: returns True if this is a child key ControlKeyDown - contains the set of special keys (shift, control, alt, meta) that are pressed ControlKeyUp - contains the set of special keys (shift, control, alt, meta) that are not pressed ('up') KeyDown - emulate the action of pressing the specified key (makes OnKeyDown respond) KeyDownBeforeInterface - informs interface that the specified key (with defined shift state) was already pressed KeyDownAfterInterface - informs interface that the specified key (with defined shift state) was pressed after an event KeyPress - simulates the action of pressing the specified key KeyUp - emulates the action of a key being released (makes OnKeyUp respond) KeyUpBeforeInterface - informs interface that the specified key (with defined shift state) was already up KeyUpAfterInterface - informs interface that the specified key (with defined shift state) was released (up) after an event UTF8KeyPress - simulates the action of pressing the specified (UTF8) key FindNextControl - returns the next control on the list; optionally checks if it is a TabStop or a parent control GetBorderStyle - returns the style of the border IsControlMouseMsg - returns True if the specified message is a control mouse message CreateHandle - generates an operating system handle CreateParams - create parameters for this windowed class

CreateParams - create parameters for this windowed class

Definition of parameters:

TCreateParams = record
    Caption: PChar;
    Style: Cardinal;
    ExStyle: Cardinal;
    X, Y: Integer;
    Width, Height: Integer;
    WndParent: HWnd;
    Param: Pointer;
    WindowClass: TWndClass;
    WinClassName: array[0..63] of Char; 
End;
CreateWnd - Creates the Window

Creates the interface object, sets parameters and assigns the handle

DestroyHandle - removes the handle for this window DestroyWnd - destroy the window for this control

Removes handles and restores colour and font flags

DoFlipChildren - reverses the order of the children FixupTabList - renders the Tab list into a suitable state InitializeWnd - initialise the window for this control

InitializeWnd - initialise the window for this control

Gets called after the Handle is created and before the child handles are created

Works out the correct bounds, sets style, fonts and colours, performs any pending resize operations

Loaded makes a number of checks, using client size if specified, and copying appropriate flags, fonts, text etc, makes list of child controls to notify them of any changes, then calls inherited Loaded TControl.Loaded MainWndProc - issus a LCL message that this is the main window procedure Called after all childs handles of the ParentForm are created. Tells all wincontrols about the final end of the handle creation phase TControl.ParentFormHandleInitialized ChildHandlesCreated - called after a child's handles are created ReAlign - realign all children RemoveFocus from this WinContro SetBorderStyle - specify the style for the border ShowControl - method for showing the specified control UpdateControlState - update the state of the control UpdateShowing - update the value of the Showing property WndProc - makes specific reactions according to the message passed, then calls inherited WndProc

LM_SETFOCUS: gets parent form and show this control as focused

LM_KILLFOCUS: removes focus fromthis control

LM_NCHITTEST: check transparency etc

Mouse and Button messages: process any docking instructions

TControl.WndProc
BorderStyle - none, or single OnGetSiteInfo - event handler for finding out information about the (docking) site Property to determine width of the window's border // properties which are supported by all descendants

Either reads a flag to find the width or sets the width.
Default is set to zero.
Finds how many of the Bounds are locked // properties which are supported by all descendants Find which type of brush to use for drawing the control // properties which are supported by all descendants Stored value of client height Read value fom flag Stored value of Client Width Reads value from flag Definitions of how any child control is to be sized Reads values from flag or stores values to flag. Most of the properties are inherited from TControlChildSizing,
which you should read to find out more about this control
The number of controls associated with this window // properties which are supported by all descendants
Reads value from flag
The indexed list of controls found in this window // properties which are supported by all descendants
Reads values from a flag; Index is a number signifying which control, from a list
Numerical value to identify the control within the window The default procedure to be associated with the window // properties which are supported by all descendants
reads or writes a flag to define what is the default procedure
The number of clients to which this control is docked Reads count from flag The indexed list of dock clients of this window Reads a flag to find the actual dock client controls The serial numbers (Index) of the dock clients Property that actually controls the docking process Reads or writes a flag. Derived from the parent class TDockManager Is this a dock site? Default false Reads or sets a flag to show whether this is a dock site. Default false Are the contents of this window to be double buffered? Reads or writes flag to determine whether double buffering is to be used Operating System Handle for identifying and manipulating this window Reads from or writes handle to flag Is the window being re-sized? Reads or writes flag to indicate re-sizing The place this control occupies in the list of tabs Reads or writes information in flag; default is -1 Is the control in the sequence of controls accessed by successive presses of the Tab key? Use the TabStop to allow or disallow access to the control using the Tab key. If the TabStop is True, the control is in the tab order. If TabStop is False, the control is not in the tab order and the user can't press the Tab key to move to the control. Event handler for dropping a control in a docked position Event handler for docking a control over another control OnEnter - event handler for when the mouse enters the control, and the control receives focus OnExit - event handler for when the mouse leaves the control and it loses focus OnKeyDown - event handler for instance when key is down while control has focus

OnKeyDown - event handler for instance when key is down while control has focus

Differs from OnKeyPress in that the key may have already been down when the control received focus; with OnKeyPress the key needs to become pressed while the control has focus.

OnKeyPress - event controller for a key being pressed while the control has focus. To properly handle national chars use UTF8KeyPress instead.

OnKeyPress - event controller for a key being pressed while the control has focus

Differs from OnKeyDown in that the key needs to become pressed while the control has focus; with OnKeyDown the key may have already been down when the control received focus.

Note: we recommend you to use OnUTF8KeyPress to prevent data lost. National chars are converted from UTF8 to the system encoding in OnKeyPressEvent. This can cause a data lost if symbol cannot be converted, which means OnKeyPress is not called or with Char=#0. OnUTF8KeyPress does not perform this conversion.

OnKeyUp - event handler for instance when a key is up (not pressed) while the control has focus

OnKeyUp - event handler for instance when a key is up (not pressed) while the control has focus

The key may already have been up when the control received focus, or a pressed key may become released during the time the control has focus.

Event handler for any movement of the mouse wheel Event handler for downward movement of the mouse wheel Event handler for upward movement of the mouse wheel OnUnDock - event handler for control becoming disconnected (undocked) from parent UTF8KeyPress - event controller for a key being pressed while the control has focus.

OnUTF8KeyPress - event controller for a key being pressed while the control has focus

Differs from OnKeyDown in that the char does not converts to the system encoding

ParentCtl3D - does it inherit Ctl3D properties from parents? (Deprecated) Is the window showing? (similar to Visible in other contexts) Use a dock manager to control docking? (default false) The number of visible client controls for docking BeginUpdateBounds - start updating the bounds of the current WinControl EndUpdateBounds - finishes updating the bounds setting LockRealizeBounds - make the realized bounds unaccessible UnlockRealizeBounds - unlock the previously locked realized bounds ControlAtPos - the identity of the control located at the specified point Pos ControlAtPos - the identity of the control located at the specified point Pos ControlAtPos - the identity of the control located at the specified point Pos ControlAtPos - the identity of the control located at the specified point Pos DoAdjustClientRectChange - perform any adjustments needed when the client rectangle changes InvalidateClientRectCache - render invalid any information in the client rectangle cache ClientRectNeedsInterfaceUpdate - True if update needed TComponent.Create TControl.Create Create - constructor for TWinControl: performs inherited Create and initialises some local variables

Create - Constructor for TWinControl: performs inherited Create and initialises some local variables

Overrides ancestor constructor, and may in turn be overridden

Among additional variables initialised are: CompStyle, ChildSizing, Brush, TabOrder and TabStop

CreateParented - constructor for a window that is the child of a specified parent CreateParentedControl - returns a newly created window control that has a specified window as its parent Destroy - destructor for TWinControl and derived classes. Removes handles and docked controls, frees resources, then calls inherited Destroy

Destroy - destructor for TWinControl and derived classes

Destroys any allocated handles, removes any docking links, and frees the resources used by the control, then performs inherited Destroy

Overrides ancestor destructors, and may in turn be overridden

TControl.Destroy
DockDrop - drop a dragged object into its docking position CanFocus - is the current window allowed to receive focus? GetControlIndex - find the index value for the given control SetControlIndex - set a new index value for the given control Focused - is the current window receiving focus? PerformTab - perform a tab - is it in the forward direction? ControlByName - returns the identity of a control whose name is given as an argument SelectNext - move to the next windowed control and give it focus BroadCast - send ToAllMessage to all recipients NotifyControls - send Msg (a message) to all controls DefaultHandler - performs CallDefaultWndHandler TObject.DefaultHandler DisableAlign - turn off any alignment EnableAlign - turn on the alignment process InsertControl - insert the specified control into the list, optionally with the specified index RemoveControl - remove the specified control from the list SetFocus - give the current control the focus FindChildControl - find what controls are descended from the current one FlipChildren - reverse the order of the child components GetTabOrderList - find the list with the Tab Order HandleAllocated - find if the operating system has allocated a handle to this control HandleNeeded - tell the Operating System that this control requires a handle BrushCreated - has a brush been created for this control? EraseBackground - remove all material from the background IntfUTF8KeyPress - returns the UTF8 value of the pressed key from the interface TGraphicControl is the base class for all lightweight controls.

TGraphicControl supports simple lightweight controls that do not need the ability to accept keyboard input or contain other controls.

Since lightweight controls do not wrap GUI screen objects, they are faster and use fewer resources than controls based on TWinControl.

TGraphicControl provides a Canvas property for access to the control's drawing surface and a virtual Paint method called in response to paint requests received by the parent control.

A reference to the parent's Canvas. The canvas isn't "owned" by the TGraphicControl, but by its parent. Virtual Paint method called in response to paint requests. Virtual Paint method called in response to paint requests received by the parent control. Create - constructor for TGraphicControl: performs inherited Create then creates local Canvas

Create - constructor for TGraphicControl: performs inherited Create then creates local Canvas

Overrides ancestor and may be overridden

TControl.Create
Destroy - destructor for TGraphicControl: frees local canvas and performs inherited Destroy

Destroy - destructor for TGraphicControl: frees local canvas and performs inherited Destroy

Overrides ancestor destructors, and may be overridden

TControl.Destroy
A clipping window to the parent canvas.

The TGraphicsControl.Canvas is a clipping window to the parent canvas.

If you ask for the Canvas.Width or Canvas.Height, you are actually getting the parent control's Canvas dimensions.

To get the dimensions of the TGraphicControl, you must query the ClientRect.

TCanvas
OnPaint - event handler for request to paint canvas TCustomControl - a base class for many window controls

Contains simple basic definitions to create, destroy and paint window controls and set basic properties like canvas and border

TWinControl TControl
WMPaint - LCL message for painting Paint handler plug-in This is a plug-in in TWinControl to get the DC,
assign it to our canvas and call the paint method for
descendants to do the actual painting
TWinControl.PaintWindow
The Device Context in which to paint Create - constructor for TCustomControl: performs inherited Create, then creates local Canvas and sets DoubleBuffered to be False TControl.Create TWinControl.Create Owner, ie the component that called this control Destroy - destructor for TCustomControl: frees local Canvas then performs inherited Destroy

Destroy - destructor for TCustomControl: frees local Canvas then performs inherited Destroy

Overrides ancestor destructors, may be overridden

TControl.Destroy TWinControl.Destroy
If the custom control has been destroyed, free its handle as well The default paint handler for the class If using a control derived from this parent, the developer needs to write a specific paint handler to override this one The area of a control on which its components are drawn or painted The Canvas is the area of screen on which the various components are drawn.
This inherits its properties from TCanvas,
and that description should be read to understand their definitions more fully.
TCanvas
Only a restricted series of options is available: none or a single border. Event handler for painting TImageList - a list of images (usually ready for dragging) TDockZone is a node in the TDockTree and encapsulates a region into which other zones or a single control are contained. This is an ancestor class for TDockTree, in the sense that it forms the elementary component of which the tree is constructed GetHeight - returns height for dock zone GetLeft - returns the position of the left hand border GetLimitBegin - returns the limit for the beginning of the zone GetLimitSize - returns the limit for the size of the zone GetTop - returns the position of the top GetVisible - returns the Visible status GetVisibleChildCount - returns the number of visible children GetWidth - returns the width of the zone GetNextVisibleZone - returns the next visible zone

Create - constructor for TDockZone: sets local variables to show the Tree to which the zone belongs and the ChildControl which it contains, sets default bounds and then performs inherited Create

Overrides ancestor constructors, and may be overridden

Create - constructor for TDockZone: sets local variables to show the Tree and the ChildControl, sets default bounds and then performs inherited Create TObject.Create
The dock tree to which this zone belongs FirstVisibleChild - returns the first visible child zone NextVisible - returns next visible PrevVisible - returns the previous visible The dock tree of which this dock zone is a part The number of child controls for docking The height of the Dock Zone The position of the left side to the control The beginning limit of the DockZone (Left or Top) The size of the limits of the DockZone (Width or Height) The top coordinate of this control Is the control visible? VisibleChildCount - the number of visible child controls The width of this control TDockZoneClass - class of TDockZone TDockTreeClass - class of TDockTree TDockTree - A tree of dock zones - every docked window has one tree
TDockTree - a tree of TDockZones - Every docked window has one tree

  
    This is an abstract class. The real implementation is in ldocktree.pas.

    Docking means here: Combining several windows to one. A window can here be
    a TCustomForm or a floating control (undocked) or a TDockForm.
    A window can be docked to another to the left, right, top, bottom or "into".
    The docking source window will be resized, to fit to the docking target
    window.

    Example1: Docking "A" (source window) left to "B" (target window)
    
       +---+    +----+
       | A | -> | B  |
       +---+    |    |
                +----+
      Result: A new docktree will be created. Height of "A" will be resized to
              the height of "B".
              A splitter will be inserted between "A" and "B".
              And all three are children of the newly created TLazDockForm of the
              newly created TDockTree.
      
       +------------+
       |+---+|+----+|
       || A ||| B  ||
       ||   |||    ||
       |+---+|+----+|
       +------------+

      If "A" or "B" were floating controls, the floating dock sites are freed.
      If "A" or "B" were forms, their decorations (title bars and borders) are
      replaced by docked decorations.
      If "A" had a TDockTree, it is freed and its child dockzones are merged to
      the docktree of "B". Analog for docking "C" left to "A":
      
       +------------------+
       |+---+|+---+|+----+|
       || C ||| A ||| B  ||
       ||   |||   |||    ||
       |+---+|+---+|+----+|
       +------------------+
       

      
    Example2: Docking A into B
                +-----+
       +---+    |     |
       | A | ---+-> B |
       +---+    |     |
                +-----+

      Result: A new docktree will be created. "A" will be resized to the size
              of "B". Both will be put into a TLazDockPages control which is the
              child of the newly created TDockTree.
              
       +-------+
       |[B][A] |
       |+-----+|
       ||     ||
       || A   ||
       ||     ||
       |+-----+|
       +-------+

    Every DockZone has siblings and children. Siblings can either be
    - horizontally (left to right, splitter),
    - vertically (top to bottom, splitter)
    - or upon each other (as pages, left to right).


    InsertControl - undock control and dock it into the manager. For example
                    dock Form1 left to a Form2:
                    InsertControl(Form1,alLeft,Form2);
                    To dock "into", into a TDockPage, use Align=alNone.
    PositionDockRect - calculates where a control would be placed, if it would
                       be docked via InsertControl.
    RemoveControl - removes a control from the dock manager.

    GetControlBounds - TODO for Delphi compatibility
    ResetBounds - TODO for Delphi compatibility
    SetReplacingControl - TODO for Delphi compatibility
    PaintSite - TODO for Delphi compatibility

TDockManager
AdjustDockRect - adjust the position of the docking rectangle for the nominated control HitTest - performs a Hit test at the specified mouse position, and returns the Control present there PaintDockFrame - paints the nominated control's canvas at the specified position UpdateAll - bring all data up to date DockSite - the site for docking Create - constructor for TDockTree: sets up the DockSite, performs inherited Create and sets default BorderWidth, creates the RootZone for the Tree

Create - constructor for TDockTree: sets up the DockSite, performs inherited Create and sets default BorderWidth, creates the RootZone for the Tree

Overrides ancestor constructors, may be overridden

TObject.Create
The window control that is to be the site for docking Destroy - destructor for TDockTree: deletes the RootZone then performs inherited Destroy

Destroy - destructor for TDockTree: deletes the RootZone then performs inherited Destroy

Overrides ancestor destructors, and may be overridden

TPersistent.Destroy
DockZoneClass - the class of dock zone TMouse - some properties of the current Mouse Contains information about current mouse position, whether it has captured an object, whether it is dragging the object, and how far the mouse is allowed to move before the captured object is made to move. Create - constructor for TMouse: calls inherited Create TObject.Create Can be a locally defined method to override the method specified by the parent object Destroy - destructor for TMouse: calls inherited Destroy TObject.Destroy System handle for the captured object Reads or writes a system variable identifying the captured object The screen position of the cursor Reads or writes a variable to determine the position of the cursor (a point with X, Y co-ordinates) Does the object get dragged as soon as the mouse moves? Reads or writes a flag to determine whether to move the object immediately the mouse moves: default is true The least distance the mouse must move before the captured object is moved Reads or writes a flag to deterine the threshold movement (if DragImmediate was false). Default is 5 pixels Is the mouse being used to drag an object? the strings that appear, eg in the Object Inspector, to describe the possible types of alignments Find the Handle for the specified Control

FindControl

Returns the TWinControl associated with the Handle.

This is very interface specific. Better use FindOwnerControl.

Handle can also be a child handle, and does not need to be the Handle property of the Result.

IMPORTANT: So, in most cases: Result.Handle <> Handle in the params.

Find the Handle for the specified Owner Control

FindOwnerControl

Returns the TWinControl owning the Handle. Handle can also be a child handle,

and does not need to be the Handle property of the Result.

IMPORTANT: Therefore, in most cases: parameter Handle <> Result.Handle

Returns a string for the name of the cursor as identified by an integer constant Calls CursorToIdent to find correct entry in look-up table Returns a string with the name of the cursor type corresponding to the integer constant StringToCursor - returns the cursor value corresponding to the name supplied

StringToCursor - returns the cursor value corresponding to the name supplied

Finds the numeric cursor value corresponding to the name S in the cursor look-up table

The numeric cursor value from the look-up table The name of the cursor for which the numeric value is sought Uses look-up table to find cursor identifier corresponding to integer cursor constant Returns true if a valid entry is found in the look-up table IdentToCursor - uses look-up table to find numeric cursor value corresponding to the Identifier string Returns True if a valid entry was found in the look-up table The name of the cursor cor which the numeric value is sought The numeric value of the named cursor Adjust space round border of this control

RemainingClientRect: remaining clientrect without CurBorderSpace

CurBorderSpace: current borderspace around RemainingClientRect

Left, Top, Right, Bottom: apply these borderspaces to CurBorderSpace

CurBorderSpace will be set to the maximum of CurBorderSpace and Left, Top, Right, Bottom.

RemainingClientRect will shrink.

RemainingClientRect will not shrink to negative size.

Register the components used in the current application, so that they can be recognised BiDiMode - enabling bi-directional writing Allows Languages such as Arabic and Hebrew to be used ParentBiDiMode - does the control follow the BiDiMode settings of its parent? Initialize the list of images for dragging TCustomImageList.Initialize BeginDrag - start the drag process; returns True if successful DragLock - returns True if dragging has been locked for the specifies window at given location DragMove - move dragged images to specified location and return True if successful DragUnlock - unlock the list of images for dragging EndDrag - retuns True if the drag process has ended HideDragImage - method for making dragged image invisible SetDragImage - place the indexed drag image at the specified location, returning True if successful ShowDragImage - display the dragged image DragCursor - the cursor for use during the dragging process DragHotspot - the position of the HotSpot (usually the pointer of the cursor) Dragging - True if dragging is proceeding Create - constructor fro TDragObject: copies AControl to local variable TObject.Create Should the image of dragged objects always be shown? The control that is to be dragged IncreaseDockArea - determine whether the area for docking is allowed to be enlarged EraseDockRect - remove the rectangle that was used for docking TDragManager - a class for managing the dragging of controls (eventually to be dropped or docked)

The declaration contains a number of procedure definitions that are 'virtual' and 'abstract'. This means that there is no implementation specified: these essentially represent 'place-holders', and it is the responsibility of the developer of descendant classes to override these methods and implement them as desired.

KeyUp - method for processing a key that is not pressed KeyDown - method for handling a key that is pressed down CaptureChanged - method for use when the identity of the captured control has changed MouseMove - method for processing a mouse movement MouseUp - method for processing a mouse button that is not pressed MouseDown - method for processing a mouse button that is pressed down Create - constructor for TDragManager: calls inherited Create and sets default drag threshold; sets DragImmediate True TComponent.Create IsDragging - returns True if dragging is in progress Dragging - returns True if the specified control is being dragged RegisterDockSite - adds the nominated site to the list or register of docking sites DragStart - begin the drag DragMove - method for dragging to specified position (virtual method - needs to be supplied by user) DragStart DragStop - finish the drag Is the dragging process to start immediately the control receives focus (eg gets captured by mouse)? The threshold amount by which the mouse must move before the dragging process starts. The threshold amount by which the mouse must move before the dragging process starts. Default is 5 pixels - irrelevant if is true GetSideSpace - finds th espace requied at the side for the specified anchor kind The size of the inner border around the control CellAlignHorizontal - the sort of horizontal alignment to use if a cell is being aligned CellAlignVertical - the sort of vertical alignment to use if a cell is being aligned Destroy - destructor for TAnchorSide: removes all anchoring links then calls inherited Destroy TPersistent.Destroy Function to find position of the cursor Procedure for the beginning of the autosizing process Procedure for the end of the autosizing process Procedure invoked when the anchor side of a different control (not the current) is changed Function to find if details of border spacing are stored Checks for changes and calls DoOnChangeBounds Determine if a parent control is involved in the alignment process Logical size of client area (e.g. in a TScrollBox the logical client area can be bigger than the visual) Is Client Height Stored? Is Client Width Stored? Protected messages to system - when context menu is required Control Message for a change in the control's text Get the list of Images to be dragged - returned as a list Sends a message to the operating system about the floating status of ADockSource GetDefaultDockCaption - returns the default string for dock caption UpdateMouseCursor - ensure co-ordinates X, Y for the cursor are correctly stored FormEndUpdated - the update for the Form has ended ParentFontChanged - method for dealing with a change in the font of the parent Procedure to deal with changes in text GetCachedText - method for retrieving caption text from cache; returns True if successful VisibleChanged - method to use when the Visible property has changed DoCallNotifyHandler - calls a Notify Handler of the specified type NeedParentForAutoSize: True - need to know parent's properties to do autosize. False - can autosize independently AnchorToCompanion - anchor to another control, not necessarily an immediate neighbour Anchor on the same side as a sibling AnchorAsAlign - Anchor following same rules as Align Anchor to the client space The number of controls anchored to this one The indexed list of controls anchored to this one Find default width (by reference to ancestor) Find the default height (by reference to ancestor) Find the default size for this class of controls (by reference to parents) Find which side is being used for anchoring CNPreferredSizeChanged - issue control signal to show that preferrd size has changed Find out the required anchor settings by reference to the parents Turn off automatic sizing - implies that default is accepted or sizing is done manually Turns on (enables) automatic sizing The rectangle defining the base bounds for this control ReadBounds - find out what bounds have been defined Used for debugging Find which control is the top parent (ie ultimate ancestor) Is the control visible on the current desktop?

Is the control visible on the current desktop?

Does not check parents

True if the form is being updated The active default control has changed to NewControl ParentDestroyingHandle - returns True if the parent control is destroying the Handle Procedure for displaying the Help associated with this control Indicates that this control has an entry in the Help-file AddHandlerOnVisibleChanging - method for adding a handler for the OnVisibleChanging event RemoveHandlerOnVisibleChanging - method to remove a handler for the OnVisibleChanging event AddHandlerOnVisibleChanged - method for adding a handler for the OnVisibleChanged event RemoveHandlerOnVisibleChanged - method to remove handler for the OnVisibleChanged event Which mouse button(s) to be used for capture? Default left button, but may be a set of up to three Is the BiDi mode stored? SetBiDiMode - specifies the BiDi mode SetParentBiDiMode - specifies the BiDi mode for the parent control CMBiDiModeChanged - issues control message when BiDi mode is changed CMParentBiDiModeChanged - issues a control message when the parent control's BiDi mode is changed UseRightToLeftAlignment - as opposed to usual left to right Needs BiDiMode enabled UseRightToLeftReading - as opposed to usual left to right Needs BiDiMode enabled UseRightToLeftScrollBar - as opposed to usual left to right Needs BiDiMode enabled IsRightToLeft - as opposed to usual left to right Needs BiDiMode enabled SetGridSpacing - specifies a value for spacing on the grid (for drawing etc) Layout - L-R then Top-Bottom, or Top-Bottom then L-R (or none) ControlsPerLine - number of controls per line CreateControlAlignList - creates a list of the controls that are aligned with the present window control ResizeDelayedAutoSizeChildren - method for re-sizing children, using autosize delayed DoDockClientMsg - issues a Dock Client message for a specified DragDropOject at a given position; returns True if successful DoUndockClientMsg - issues a message to undock a client control; returns True if successful DoSendShowHideToInterface - send the Show/Hide status to the interface RealizeBoundsRecursive - perform RealizeBounds in a recursive manner CMBiDiModeChanged - control message for a change in the BiDiMode property DoGetDockCaption - find the caption for the docked control SendDialogChar - LCL key message: returns True if a dialog character has been sent SelectFirst - select the first control on the list FinalizeWnd - getting ready to remove window (gets called before the Handle is destroyed) FormEndUpdated - calls inherited FormEndUpdated then informs each child control TControl.FormEndUpdated SetChildZPosition - specify the position of the child control in the Z plane (ie front-to-back) WSSetText - writes the name of the current widget set to a local variable OnGetDockCaption - event handler to find the caption for the docked control AddControl - add this control to the list of controls GetDockCaption - get the caption for the specified docked control PaintTo - Paint to a specified position on the canvas SetShape - make the specified shape appear on the Window AllocBy - for allocation BlendColor - the colour for blending FindZone - returns the Dockzone for the nominated control AddAsFirstChild - add a new zone as the first child AddAsLastChild - add an new zone as the last child ReplaceChild - replace the OldChild zone with the NewChild GetLastChild - returns the last child zone GetIndex - returns the index of the current zone Remove the nominated child zone The child control to be docked here The first child control in the list of controls for docking Whether docking is oriented vertically, horizontally, in pages, or not at all

doNoOrient : zone contains a TControl and no child zones.

doHorizontal : zone's children are stacked top-to-bottom.

doVertical : zone's children are arranged left-to-right.

doPages : zone's children are pages arranged left-to-right.

The parent dock zone to which this control is docked The next sibling (related control atthe same level) in the list of docked controls The previous sibling (control at the same level) in the list of docked controls SetDockZoneClass - specifies the class of dock zone RootZone - the zone that forms the root of the current Dock Tree WheelScrollLines - the number of lines the the scroll wheel has traversed Anchor to the bottom The height of this control OnMouseWheel - event handler for a movement of the mouse wheel OnMouseWheelDown - event handler for downward movement of mouse wheel OnMouseWheelUp - event handler for upward movement of mouse wheel InvalidatePreferredChildSizes - renders the preferred child sizes invalid AutoCreated - if True, the drag object is automatically created EndDrag - method for terminating drag of nominated object at specified location AdjustDockRect - the position for offsetting the dock point MouseMessage - message sent to system for mouse events AutoFreeByControl - returns True if an object has been automatically freed by a control Protected message to system - when mouse wheel moves DoMouseWheel - performs the action to deal with a movement of the mouse wheel; returns True if handled DoMouseWheelDown - performs the action for a downward movement of the mouse wheel; returns True if handled DoMouseWheelUp - performs the action for an upward movement of the mouse wheel; returns True if handled CreateControlBorderSpacing - calls TControlBorderSpacing.Create to create the border spacing for this control TControlBorderSpacing.Create Protected message to system for CancelMode Control Message when a special key is needed CustomAlignInsertBefore - returns True if the OnAlignInsertBefore event handler has been assigned and executes successfully CustomAlignPosition calls the OnAlignPosition event handler to make a highly specified alignment CMBorderChanged - ControlMessage for a change in the Border property OnAlignInsertBefore - event handler for an aligned insertion before action OnAlignPosition - event handler for supplying align position AddSibling - insers a new sibling control into the dock zone DumpLayout - stores layout in a file SetLimitBegin - specifies the limit for the beginning of the zone SetLimitSize - specifies the limit for the size of the zone SetHeight - specifies the height of the zone SetLeft - specifies the left side of the zone SetTop - specifies the top of the zone SetWidth - specifies the width of the zone AutoSize - boolean property that permits the size of a control to be adjusted automatically

AutoSize is a boolean property found in many classes; it permits the size of a control to be adjusted automatically to accommodate differences in the text or graphic contained therein, and allows most efficient use of available space

Many controls call TControl.DoAutoSize to perform the actual auto-sizing.

IMPORTANT: Many Delphi controls override this method and many call this method directly after setting some properties.

During handle creation not all interfaces can create complete Device Contexts which are needed to calculate things like text size.

That's why you should always call AdjustSize instead of DoAutoSize.

TControl.AdjustSize calls DoAutoSize in a smart fashion.

During loading and handle creation the calls are delayed.

This method initially does the same as TWinControl.DoAutoSize. But since DoAutoSize is commonly overriden by descendant components, it is not useful to perform all tests, which can result in too much overhead. To reduce this the LCL calls AdjustSize instead.

When setting AutoSize = true the LCL autosizes the control in width and height. This is one of the most complex parts of the LCL, because the result depends on nearly a hundred properties. Let's start simple:

The LCL will only autosize the Width or Height if it is free to resize. In other words - the width is not autosized if:

  • the left and right side is anchored. You can anchor the sides with the Anchors property or by setting the Align property to alTop, alBottom or alClient
  • the Width and Height are bound by the Constraints properties. The Contraints can also be overriden by the widgetset. For example the winapi does not allow resizing the height of a combobox. And the gtk widgetset does not allow resizing the width of a vertical scrollbar

The new size is calculated by the protected method TControl.CalculatePreferredSize. This method asks the widgetset for an appropriate Width and Height. For example a TButton has preferred Width and Height. A TComboBox has only a preferred Height. The preferred Width is returned as 0 and so the LCL does not autosize the Width - it keeps the width unaltered. Finally a TMemo has no preferred Width or Height. Therefore AutoSize has no effect on a TMemo.

Some controls override this method. For example the TGraphicControl descendants like TLabel have no window handle and so cannot query the widgetset. They must calculate their preferred Width and Height themselves.

The widgetsets must override the GetPreferredSize method for each widget class that has a preferred size (Width or Height or both).

Parent.AutoSize

The above described the simple explanation. The real algorithm provides far more possibilities and is therefore far more complex.

Properties / Methods

  • Left
  • Top

If Parent is not nil then Left, Top are the pixel distance to the top, left pixel of the parent's client area (not scrolled). Remember the client area is always without the frame and scrollbars of the parent. For Delphi users: Some VCL controls like TGroupbox define the client area as the whole control including the frame and some not - the LCL is more consistent, and therefore Delphi incompatible. Left and Top can be negative or bigger than the client area. Some widgetsets define a minimum/maximum somewhere around 10.000 or more.

When the client area is scrolled the Left and Top are kept unchanged.

During resizing/moving Left and Top are not always in sync with the coordinates of the Handle object.

If Parent=nil then Left, Top depend on the widgetset and the window manager. Till Lazarus 0.9.25 this is typically the screen coordinate of the left,top of the client area of the form. This is Delphi incompatible. It is planned to change this to the Left, Top of the window.

Hint:

Each time you change Left and Top the LCL moves instantly. If you want to change both Left and Top use instead:

with Button1 do SetBounds(NewLeft,NewTop,Width,Height);
  • Width
  • Height

The Size in pixels must not be negative, and most widgetsets do not allow Width=0 and/or Height=0. Some controls on some platforms define a bigger minimum constraint. Instead of sizing a control to Width=0 and/or Height=0, set Visible=false. During resizing/moving Width and Height are not always in sync with the size of the Handle object.

  • BoundsRect

Same as Bounds(Left,Top,Width,Height).

Common newbie mistake:

BoundsRect.Left:=3; // WRONG: common newbie mistake

This has no effect, because reading BoundsRect is a function. It creates a temporary TRect on the stack.

  • ClientRect

Left and Top are always 0,0. Width and Height are the visible size in pixels of the client area. Remember the client area is without the frame and without scrollbars. In a scrollable client area the logical client area can be bigger than the visible.

  • ClientOrigin

Returns the screen coordinate of the top left coordinate 0,0 of the client area. Note that this value is the position as stored in the interface and is not always in sync with the LCL. When a control is moved, the LCL sets the bounds to the desired position and sends a move message to the interface. It is up to the interface to handle moves instantly or queued.

  • LCLIntf.GetClientBounds

Returns the client bounds of a control. Like ClientRect, but Left and Top are the pixel distances to the control's left, top. For example on a TGroupBox the Left, Top are the width and height of the left and top frame border. Scrolling has no effect on GetClientBounds.

  • LCLIntf.GetWindowRect

After the call, ARect will be the control area in screen coordinates. That means, Left and Top will be the screen coordinate of the TopLeft pixel of the Handle object and Right and Bottom will be the screen coordinate of the BottomRight pixel.

  • FBaseBoundsLock: integer

Increased/Decreased by LockBaseBounds/UnlockBaseBounds. Used to keep FBaseBounds during SetBounds calls.

  • FBaseParentClientSize: TPoint

The Parent.ClientRect size valid for the FBaseBounds. FBaseBounds and FBaseParentClientSize are used to calculate the distance for akRight (akBottom). When the parent is resized, the LCL knows what distance to keep.

  • FBoundsRectForNewParent: TRect

When changing the Parent of a control the Handle is recreated and many things can happen. Especially for docking forms the process is too unreliable. Therefore the BoundsRect is saved. The VCL uses a similar mechanism.

  • fLastAlignedBounds: TRect

See TControl.SetAlignedBounds for an explanation. In short: It stops some circles between interface and LCL autosizing.

  • FLastChangebounds: TRect

Used to stop calling ChangeBounds with the same coordinates. This happens very often.

  • FLastDoChangeBounds: TRect

Used to avoid calling OnChangeBounds with the same coordinates. This reduces user defined autosizing.

  • FLastResizeClientHeight: integer
  • FLastResizeClientWidth: integer
  • FLastResizeHeight: integer
  • FLastResizeWidth: integer

Used to avoid calling OnResize with the same coordinates. This reduces user defined autosizing.

  • FLoadedClientSize: TPoint

During loading many things are delayed and many things are set and worse: in the wrong order. That's why SetClientWidth/SetClientHeight calls are stored and set at end of loading again. This way the LCL can restore the distances (e.g. akRight) used during designing.

  • FReadBounds: TRect

Same as FLoadedClientSize, but for SetLeft, SetTop, SetWidth, SetHeight.

  • procedure SetBoundsRectForNewParent(const AValue: TRect);

Used to set FBoundsRectForNewParent. See above.

  • procedure SetAlignedBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;

Sets fLastAlignedBounds, see above.

  • procedure SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;

A smart version of SetBounds, reducing overhead during creation and loading.

  • procedure UpdateBaseBounds(StoreBounds, StoreParentClientSize, UseLoadedValues: boolean); virtual;

Commit current bounds to base bounds.

  • procedure SetClientHeight(Value: Integer);
  • procedure SetClientSize(Value: TPoint);
  • procedure SetClientWidth(Value: Integer);

Exists for Delphi compatibility too. Resizes the control, to get the wanted ClientRect size.

  • procedure ChangeBounds(ALeft, ATop, AWidth, AHeight: integer); virtual;

This is the internal SetBounds. Applies constraints, updates base bounds, calls OnChangeBound, OnResize, locks bounds.

  • procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); virtual;

This really sets the FLeft, FTop, FWidth, FHeight private variables.

  • procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;

This is the standard procedure overriden by many Delphi controls. TWinControl overrides it too.

Ignores calls when bounds are locked; lock the FBoundsRealized to avoid overhead to the interface during auto sizing.

ChangeBounds is not locked this way.

  • Function GetClientOrigin: TPoint; virtual;

Screen coordinate of Left, Top of client area.

  • Function GetClientRect: TRect; virtual;

Size of client area. (always Left=0, Top=0)

  • Function GetScrolledClientRect: TRect; virtual;

Visible client area in ClientRect.

  • function GetChildsRect(Scrolled: boolean): TRect; virtual;

Returns the Client rectangle relative to the control's Left, Top. If Scrolled is true, the rectangle is moved by the current scrolling values (for an example see TScrollingWincontrol).

  • function GetClientScrollOffset: TPoint; virtual;

Returns the scrolling offset of the client area.

  • function GetControlOrigin: TPoint; virtual;

Returns the screen coordinate of the topleft coordinate 0,0 of the control area. (The topleft pixel of the control on the screen) Note that this value is the position as stored in the interface and is not always in sync with the LCL. When a control is moved, the LCL sets the bounds to the wanted position and sends a move message to the interface. It is up to the interface to handle moves instantly or queued.