THYBaseMenuItem

Overview

THYBaseMenuItem is a base class for menu items in the Hydra framework. This class implements the IHYVCLMenuItem interface and provides basic functionality for menu item manipulation.

You will not have to deal with this class directly, instead, you can use the IHYVCLMenuItem interface for menu item manipulation.

Note: For more information on menu and toolbar usage in the Hydra framework, please refer to this article. Please also look at the Actions sample shipped with Hydra to see menu and toolbar merging in action.

Location


 

constructor Create (TObject, THYBaseController)  reintroduce virtual    (declared in THYControl)

Creates a new instance of the class.

constructor Create(anObject: TObject; aController: THYBaseController)

Parameters:

  • anObject: Object that is wrapped by this class, if anObject is nil, an EHYException is raised.
  • aController: References to a controller that is used to manage this control.

constructor Create (TObject, THYBaseMenuController)  reintroduce virtual

Creates a new instance of the class.

constructor Create(anObject: TObject; aController: THYBaseMenuController)

Parameters:

  • anObject: Object that is wrapped by this class, if anObject is nil, an EHYException is raised.
  • aController: References to a controller that is used to manage this control.

constructor Create (TObject, Boolean)  reintroduce virtual    (declared in THYObjectReference)

Creates a new instance of the class.

constructor Create(anObject: TObject; OwnsObject: Boolean)

Parameters:

  • anObject: Object that is wrapped by this class, if anObject is nil, an EHYException is raised.
  • OwnsObject: If set to true, the referenced object will be freed when this class is destroyed.

Add (TBasicAction): IHYVCLMenuItem  protected overload

Adds a new item and fills it with information from the action object.

function Add(anAction: TBasicAction): IHYVCLMenuItem

Parameters:

  • anAction: Reference to an action.

Add (string): IHYVCLMenuItem  protected overload

Adds a new item with the specified caption.

function Add(const aCaption: string): IHYVCLMenuItem

Parameters:

  • aCaption: Caption of the item.

AddMenu  protected

Adds a new menu with the specified caption.

function AddMenu(const aCaption: string): IHYVCLMenuItem

Parameters:

  • aCaption: Caption of the menu.

AddSeparator  protected

Adds a separator line.

function AddSeparator: IHYVCLMenuItem

Controller    (declared in THYControl)

References to a controller that is used to manage this control.

property Controller: THYBaseController read

Controller

Holds a reference to the menu controller class.

property Controller: THYBaseMenuController read

Delete  protected

Deletes the menu item with the given index.

procedure Delete(Index: Integer)

Parameters:

  • Index: Index of the item.

DestroyObject  protected    (declared in THYObjectReference)

Destroys the referenced object.

procedure DestroyObject

DoDelete  protected virtual abstract

Deletes the menu item with the given index from the underlying menu.

procedure DoDelete(Index: Integer)

Parameters:

  • Index: Index of the item.

DoGetCount  protected virtual

Gets number of menu items from the underlying menu.

function DoGetCount: Integer

DoGetIndex  protected virtual abstract    (declared in THYControl)

Returns an item index from the underlying control.

function DoGetIndex: Integer

DoGetItems  protected virtual abstract

Gets item with given index from the underlying menu.

function DoGetItems(Index: Integer): IHYVCLMenuItem

Parameters:

  • Index: Index of the item.

DoInsert  protected virtual abstract

Inserts a new item into the underlying menu class.

function DoInsert(anIndex: Integer; anAction: TBasicAction): IHYVCLMenuItem

Parameters:

  • anIndex: Index of the item.
  • anAction: Reference to an action.

DoInsertMenu  protected virtual abstract

Inserts a new menu into the underlying menu class.

function DoInsertMenu(anIndex: Integer; const aCaption: string): IHYVCLMenuItem

Parameters:

  • anIndex: Index of the item.
  • aCaption: Caption of the item.

DoInsertSeparator  protected virtual abstract

Inserts a separator line into the underlying menu class.

function DoInsertSeparator(anIndex: Integer): IHYVCLMenuItem

Parameters:

  • anIndex: Index of the item.

FindMenuItem  protected

Searches for the menu item with the given caption. If no menu item with specified caption can be found,nil is returned.

function FindMenuItem(const aCaption: string): IHYVCLMenuItem

Parameters:

  • aCaption: Caption of the item.

GetAction  protected dynamic    (declared in THYControl)

Gets an action associated with underlying control.

function GetAction: TBasicAction

GetCaption  protected dynamic    (declared in THYControl)

Gets caption of the underlying control.

function GetCaption: string

GetCount  protected

Gets number of menu items.

function GetCount: Integer

GetImages  protected virtual abstract

Gets reference of the image list associated with menu.

function GetImages: TCustomImageList

GetIndex  protected dynamic    (declared in THYControl)

Gets an item index from the underlying control.

function GetIndex: Integer

GetItems  protected

Gets item with given index.

function GetItems(Index: Integer): IHYVCLMenuItem

Parameters:

  • Index: Index of the item.

GetProperty  protected    (declared in THYObjectReference)

Retrieves the value of the published property of the referenced object.

function GetProperty(const aName: string): variant

Parameters:

  • aName: Name of the property.

GetRefObject  protected    (declared in THYObjectReference)

Gets referenced object.

function GetRefObject: TObject

Insert (Integer, TBasicAction): IHYVCLMenuItem  protected overload

Inserts a new item and fills it with information from the given action object into the position specified by the anIndex parameter.

function Insert(anIndex: Integer; anAction: TBasicAction): IHYVCLMenuItem

Parameters:

  • anIndex: Index of the item.
  • anAction: Reference to an action.

Insert (Integer, string): IHYVCLMenuItem  protected overload

Inserts a new item with the given caption into the position specified by the anIndex parameter.

function Insert(anIndex: Integer; const aCaption: string): IHYVCLMenuItem

Parameters:

  • anIndex: Index of the item.
  • aCaption: Caption of the item.

InsertMenu  protected

Inserts a new menu with the given caption into the position specified by the anIndex parameter.

function InsertMenu(anIndex: Integer; const aCaption: string): IHYVCLMenuItem

Parameters:

  • anIndex: Index of the item.
  • aCaption: Caption of the item.

InsertSeparator  protected

Inserts a separator line into the position specified by the anIndex parameter.

function InsertSeparator(anIndex: Integer): IHYVCLMenuItem

Parameters:

  • anIndex: Index of the item.

Searches for the menu item with the given caption. If no menu item with the specified caption can be found, an EHYException is raised.

function MenuItemByCaption(const aCaption: string): IHYVCLMenuItem

Parameters:

  • aCaption: Caption of the item.

SetAction  protected dynamic    (declared in THYControl)

Sets an action associated with underlying control.

procedure SetAction(Value: TBasicAction)

Parameters:

  • Value: Reference to an action.

SetCaption  protected dynamic    (declared in THYControl)

Sets caption of the underlying control.

procedure SetCaption(const Value: string)

Parameters:

  • Value: New value of the caption.

SetImages  protected virtual abstract

Sets reference of the image list.

procedure SetImages(Value: TCustomImageList)

Parameters:

  • Value: Reference to an image list.

SetProperty  protected    (declared in THYObjectReference)

Sets the value of the published property of the referenced object.

procedure SetProperty(const aName: string; const aPropertyValue: variant)

Parameters:

  • aName: Name of the property.
  • aPropertyValue: Value of the property.

 

Controller    (declared in THYControl)

References to a controller that is used to manage this control.

property Controller: THYBaseController read

Controller

Holds a reference to the menu controller class.

property Controller: THYBaseMenuController read

 

constructor Create (TObject, THYBaseController)  reintroduce virtual    (declared in THYControl)

Creates a new instance of the class.

constructor Create(anObject: TObject; aController: THYBaseController)

Parameters:

  • anObject: Object that is wrapped by this class, if anObject is nil, an EHYException is raised.
  • aController: References to a controller that is used to manage this control.

constructor Create (TObject, THYBaseMenuController)  reintroduce virtual

Creates a new instance of the class.

constructor Create(anObject: TObject; aController: THYBaseMenuController)

Parameters:

  • anObject: Object that is wrapped by this class, if anObject is nil, an EHYException is raised.
  • aController: References to a controller that is used to manage this control.

constructor Create (TObject, Boolean)  reintroduce virtual    (declared in THYObjectReference)

Creates a new instance of the class.

constructor Create(anObject: TObject; OwnsObject: Boolean)

Parameters:

  • anObject: Object that is wrapped by this class, if anObject is nil, an EHYException is raised.
  • OwnsObject: If set to true, the referenced object will be freed when this class is destroyed.

Add (TBasicAction): IHYVCLMenuItem  protected overload

Adds a new item and fills it with information from the action object.

function Add(anAction: TBasicAction): IHYVCLMenuItem

Parameters:

  • anAction: Reference to an action.

Add (string): IHYVCLMenuItem  protected overload

Adds a new item with the specified caption.

function Add(const aCaption: string): IHYVCLMenuItem

Parameters:

  • aCaption: Caption of the item.

AddMenu  protected

Adds a new menu with the specified caption.

function AddMenu(const aCaption: string): IHYVCLMenuItem

Parameters:

  • aCaption: Caption of the menu.

AddSeparator  protected

Adds a separator line.

function AddSeparator: IHYVCLMenuItem

Delete  protected

Deletes the menu item with the given index.

procedure Delete(Index: Integer)

Parameters:

  • Index: Index of the item.

DestroyObject  protected    (declared in THYObjectReference)

Destroys the referenced object.

procedure DestroyObject

DoDelete  protected virtual abstract

Deletes the menu item with the given index from the underlying menu.

procedure DoDelete(Index: Integer)

Parameters:

  • Index: Index of the item.

DoGetCount  protected virtual

Gets number of menu items from the underlying menu.

function DoGetCount: Integer

DoGetIndex  protected virtual abstract    (declared in THYControl)

Returns an item index from the underlying control.

function DoGetIndex: Integer

DoGetItems  protected virtual abstract

Gets item with given index from the underlying menu.

function DoGetItems(Index: Integer): IHYVCLMenuItem

Parameters:

  • Index: Index of the item.

DoInsert  protected virtual abstract

Inserts a new item into the underlying menu class.

function DoInsert(anIndex: Integer; anAction: TBasicAction): IHYVCLMenuItem

Parameters:

  • anIndex: Index of the item.
  • anAction: Reference to an action.

DoInsertMenu  protected virtual abstract

Inserts a new menu into the underlying menu class.

function DoInsertMenu(anIndex: Integer; const aCaption: string): IHYVCLMenuItem

Parameters:

  • anIndex: Index of the item.
  • aCaption: Caption of the item.

DoInsertSeparator  protected virtual abstract

Inserts a separator line into the underlying menu class.

function DoInsertSeparator(anIndex: Integer): IHYVCLMenuItem

Parameters:

  • anIndex: Index of the item.

FindMenuItem  protected

Searches for the menu item with the given caption. If no menu item with specified caption can be found,nil is returned.

function FindMenuItem(const aCaption: string): IHYVCLMenuItem

Parameters:

  • aCaption: Caption of the item.

GetAction  protected dynamic    (declared in THYControl)

Gets an action associated with underlying control.

function GetAction: TBasicAction

GetCaption  protected dynamic    (declared in THYControl)

Gets caption of the underlying control.

function GetCaption: string

GetCount  protected

Gets number of menu items.

function GetCount: Integer

GetImages  protected virtual abstract

Gets reference of the image list associated with menu.

function GetImages: TCustomImageList

GetIndex  protected dynamic    (declared in THYControl)

Gets an item index from the underlying control.

function GetIndex: Integer

GetItems  protected

Gets item with given index.

function GetItems(Index: Integer): IHYVCLMenuItem

Parameters:

  • Index: Index of the item.

GetProperty  protected    (declared in THYObjectReference)

Retrieves the value of the published property of the referenced object.

function GetProperty(const aName: string): variant

Parameters:

  • aName: Name of the property.

GetRefObject  protected    (declared in THYObjectReference)

Gets referenced object.

function GetRefObject: TObject

Insert (Integer, TBasicAction): IHYVCLMenuItem  protected overload

Inserts a new item and fills it with information from the given action object into the position specified by the anIndex parameter.

function Insert(anIndex: Integer; anAction: TBasicAction): IHYVCLMenuItem

Parameters:

  • anIndex: Index of the item.
  • anAction: Reference to an action.

Insert (Integer, string): IHYVCLMenuItem  protected overload

Inserts a new item with the given caption into the position specified by the anIndex parameter.

function Insert(anIndex: Integer; const aCaption: string): IHYVCLMenuItem

Parameters:

  • anIndex: Index of the item.
  • aCaption: Caption of the item.

InsertMenu  protected

Inserts a new menu with the given caption into the position specified by the anIndex parameter.

function InsertMenu(anIndex: Integer; const aCaption: string): IHYVCLMenuItem

Parameters:

  • anIndex: Index of the item.
  • aCaption: Caption of the item.

InsertSeparator  protected

Inserts a separator line into the position specified by the anIndex parameter.

function InsertSeparator(anIndex: Integer): IHYVCLMenuItem

Parameters:

  • anIndex: Index of the item.

Searches for the menu item with the given caption. If no menu item with the specified caption can be found, an EHYException is raised.

function MenuItemByCaption(const aCaption: string): IHYVCLMenuItem

Parameters:

  • aCaption: Caption of the item.

SetAction  protected dynamic    (declared in THYControl)

Sets an action associated with underlying control.

procedure SetAction(Value: TBasicAction)

Parameters:

  • Value: Reference to an action.

SetCaption  protected dynamic    (declared in THYControl)

Sets caption of the underlying control.

procedure SetCaption(const Value: string)

Parameters:

  • Value: New value of the caption.

SetImages  protected virtual abstract

Sets reference of the image list.

procedure SetImages(Value: TCustomImageList)

Parameters:

  • Value: Reference to an image list.

SetProperty  protected    (declared in THYObjectReference)

Sets the value of the published property of the referenced object.

procedure SetProperty(const aName: string; const aPropertyValue: variant)

Parameters:

  • aName: Name of the property.
  • aPropertyValue: Value of the property.