Sign in Join
FPDoc Onlineexperiment

TMenuItem.SetParentComponent procedure

Member of TMenuItemprotectedIn unit Menus

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

Declaration

pascal
procedure 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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.