IHYMenuItem Interface

From RemObjects Wiki
Jump to: navigation, search

This is a Library topic for Hydra for Delphi
This page is generated from external data, please do not update

InterfacesClassesEnumsAliasesImplements

Contents

Overview

IHYMenuItem is an interface that represents menu items for the Hydra framework. Inside the Hydra framework, this interface is used to provide support for menu merging between host and plugins.

You can read about menu and toolbar merging in this article.

Use Case

You may use this interface to manipulate menu items, as an example, the following code demonstrates how you can manually add menu items into your host application menu:

procedure TTextEditor.HYPluginControlsRepository1AfterMergeMenuItems(
  Sender: THYPluginControlsRepository; const aHost: IHYHost;
    const anUpdateID: TGUID);
var filemenu : IHYMenuItem;
begin
  // Here, we customize manually, since the Open and
  // Save items need to go under the File menu
  if (aHost.MenuController=NIL) then Exit;
  
  filemenu := aHost.MenuController.Items.MenuItemByCaption('File');
  filemenu.Insert(0, actOpen);
  filemenu.Insert(1, actSave);
  filemenu.InsertSeparator(2);
end;

Note: Take a look at the Actions sample shipped with Hydra to see menu and toolbar merging in action.


Location

uHYIntf.pas

Implemented in


Properties

Action     (declared in IHYControl)

Gets or sets the reference to the action associated with the control.



property Action: TBasicAction read write


Caption     (declared in IHYControl)

Gets or sets the caption associated with the control.



property Caption: string read write


Count

Gets the number of subitems of the menu item.



property Count: integer read


Index     (declared in IHYControl)

Gets the index associated with the control.



property Index: integer read


Items

Gets reference to a menu item with specified index.



property Items[Index: integer]: IHYMenuItem read


Properties     (declared in IHYObjectReference)

Gets or sets the value of the published properties of the referenced object with specified name.



property Properties[aName: string]: variant read write


RefObject     (declared in IHYObjectReference)

Gets a pointer to the referenced object.



property RefObject: TObject read


Required Methods

Add (string): IHYMenuItem   overload

Adds a new item with specified caption.


function Add(const aCaption: string): IHYMenuItem


Parameters:

  • aCaption: Title of the item.


Add (TBasicAction): IHYMenuItem   overload

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


function Add(anAction: TBasicAction): IHYMenuItem


Parameters:

  • anAction: Reference to an action object.


AddMenu

Adds a new menu with the specified caption.


function AddMenu(const aCaption: string): IHYMenuItem


Parameters:

  • aCaption: Title of the item.


AddSeparator

Adds a separator line.


function AddSeparator: IHYMenuItem


Delete

Deletes the menu item with the given index.


procedure Delete(Index: integer)


Parameters:

  • Index: Index of the item.


DestroyObject     (declared in IHYObjectReference)

Destroys referenced object.


procedure DestroyObject


FindMenuItem

Searches for the menu item with the given caption, if this menu item does not exist, nil is returned.


function FindMenuItem(const aCaption: string): IHYMenuItem


Parameters:

  • aCaption: Caption of the item.


Insert (integer, string): IHYMenuItem   overload

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


function Insert(anIndex: integer; const aCaption: string): IHYMenuItem


Parameters:

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


Insert (integer, TBasicAction): IHYMenuItem   overload

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


function Insert(anIndex: integer; anAction: TBasicAction): IHYMenuItem


Parameters:

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


InsertMenu

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


function InsertMenu(anIndex: integer; const aCaption: string): IHYMenuItem


Parameters:

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


InsertSeparator

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


function InsertSeparator(anIndex: integer): IHYMenuItem


Parameters:

  • anIndex: Index of the item.


MenuItemByCaption

Searches for the menu item with the given caption, if this menu item does not exists, an EHYException is raised.


function MenuItemByCaption(const aCaption: string): IHYMenuItem


Parameters:

  • aCaption: Caption of the item.


See Also


Product: RemObjects Hydra
Current version: Hydra 4.0

GlossaryArchitectureArticlesLibrarySamples

Personal tools
Namespaces

Variants
Actions
Navigation
products
platforms
special
Toolbox