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

TMenuItem.SetParentComponent

Ensures that the menu item is parented by the specified menu or menu item.

Declaration

Source position: menus.pp line 244

protected procedure TMenuItem.SetParentComponent(

  AValue: TComponent

); override;

Arguments

AValue

  

Menu or menu item used as the parent for the current class instance.

Description

SetParentComponent is an overridden method used to ensure that the menu item is parented by the menu or menu item specified in AValue. SetParentComponent re-implements the method introduced in the ancestor class, and does not call the inherited method.

When Parent has been assigned, its Remove method is called to delete the current class instance from its Items.

When AValue has been assigned, the value is examined to determine if the new parent is a TMenu or a TMenuItem instance. If it is a TMenu instance, the current class instance is added to its Items property. If it is a TMenuItem instance, its Add method is called to append the current class instance to its Items property.

An Exception is raised if AValue is derived from any class type other than TMenu or TMenuItem. The current class instance is not re-parented when AValue contains Nil.

See also

TComponent


Version 3.2 Generated 2024-02-25 Home