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

TMenuItem.Insert

Insert stores the specified menu item at the location indicated by Index.

Declaration

Source position: menus.pp line 279

public procedure TMenuItem.Insert(

  Index: Integer;

  Item: TMenuItem

);

Arguments

Index

  

Ordinal position in Items where the menu item is inserted.

Item

  

Menu item inserted in Items.

Description

No actions are performed in the method when Item is unassigned (contains Nil).

A catchable debugger exception is raised if the Parent in Item is already assigned. The exception message is 'Menu inserted twice'.

Insert ensures that the TMenuItems storage has been allocated for the TMenuItem instances in the Items property.

Insert modifies Item to use the current class as the Parent for the menu item, and assigns the private method used in the OnChange handler in Item. If Item is Visible, its handle is allocated when not already assigned.

MenuChanged is called to signal the OnChange event handler when assigned.

Insert is called from the Add method, and when the Parent menu item is changed after setting a new value in the MenuIndex property.

See also

TMenuItem.Items

  

Provides indexed access to the child menu items for the current class instance.

TMenuItem.Parent

  

The parent menu item for the class instance.

TMenuItem.Visible

  

Indicates whether the menu item is visible (True) or hidden (False).

TMenu.OnChange

  

Event handler signalled when a menu item in Items has been changed.

TMenuItems

  

Implements a list used to store TMenuItem instances with a given parent.


Version 3.2 Generated 2024-02-25 Home