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

TToolButton.SetParent

Sets the value for the Parent property.

Declaration

Source position: comctrls.pp line 2157

protected procedure TToolButton.SetParent(

  AParent: TWinControl

); override;

Arguments

AParent

  

New value for the Parent property.

Description

SetParent is an overridden method in TToolButton used to set the value for the Parent property.

SetParent ensures that the control in AParent is assigned, and allows child classes using the TToolButton class type. An EInvalidOperation exception is raised if the class instance cannot be a child control on AParent, or AParent is also the current class instance.

When the parent tool bar has been assigned, the tool button must be re-parented. The RemoveButton method in the tool bar is called to remove the button from its existing Parent. If AParent is a TToolBar instance, its properties are used to set the ButtonWidth and ButtonHeight for the control. The inherited method is called to update both the old and new Parent references and their control flags.

The value in the internal tool bar member is set to the value in AParent, and the AddButton method in the tool bar is called. The UpdateVisibleToolbar method is calls to align and re-display the button control (and its tool bar).

Errors

Raises an EInvalidOperation exception if the class instance cannot be a child control on the new Parent, or the new AParent is also the current class instance.

See also

TControl.Parent

  

The control within which the control is shown.

TControl.SetParent

  

Sets the value for the Parent property.


Version 3.2 Generated 2024-02-25 Home