Unit 'MUIClass.Menu' Package
[Overview][Classes][Index] [#MUIClass]

TMUIMenuItem

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Menuitem class describes a single menu item.

Declaration

Source position: MUIClass.Menu.pas line 47

type TMUIMenuItem = class(TMUIFamily)

protected

  procedure GetCreateTags(); override;

  

Fill TagList for MUI item creation

public

  constructor Create; override;

  

Create a MenuItem object

  procedure CreateObject; override;

  

Create the MUI item

  procedure AfterCreateObject; override;

  

Connect Evetns after MUI item creation

published

  property Checked: Boolean; [rw]

  

Set/Get the State of checkable Menu items.

  property CheckIt: Boolean; [rw]

  

Define Entry as checkable Menu item

  property CommandString: Boolean; [rw]

  

Set to True if ShortCut is a full key sequence.

  property Enabled: Boolean; [rw]

  

Enabled/Disable the menu item.

  property Exclude: LongWord; [rw]

  

Bitmask of menu item numbers that are to be deselected when this one is selected.

  property ShortCut: string; [rw]

  

Define the shortcut for a menu item.

  property Title: string; [rw]

  

Define the items title.

  property Toggle: Boolean; [rw]

  

Automatically toggle state when item is selected

  property OnTrigger: TNotifyEvent; [rw]

  

Event when the Menu item is selected.

end;

Inheritance

TMUIMenuItem

  

Menuitem class describes a single menu item.

|

TMUIFamily

  

Base class with list of children

|

TMUIWithParent

  

Subclass of TNotify to introduce the Parent relation

|

TMUINotify

  

Notify class is superclass of all other MUI classes.

|

TMUIRootClass

  

Base class for all MUI Class

|

TObject

Description

You can use all of the gadtools menus features expect Image menus here.

Since Menuitem class is a subclass of Family class, you can add other menu items as children of a menu item to indicate sub menus. MUI does not limit the level of sub menus, but the operating system currently allows a maximum nesting level of one. Because of this, children of menu items should not contain other menu items for now, the results are unpredictable.

Example:

MainMenu := TMUIMenuStrip.Create;

// MUIApp.MenuStrip := MainMenu; // alternative on the application, activate only one!
Window.Menustrip := MainMenu;

Men := TMUIMenu.Create;
with Men do
begin
  Title := 'Test Menu';   // Name of Menu (thats the one in the ScreenBar)
  Parent := MainMenu;     // attach to the Menustrip
end;

With TMUIMenuItem.Create do
begin
  Title := 'Config';         // Text on the menu item
  Parent := Men;             // attach to the Menu
  OnTrigger := @ConfigStart; // Event to call when selected
end;

with TMUIMenuItem.Create do
begin
  Title := 'Quit';
  Parent := Men;
  OnTrigger := @QuitMe;
end;

See also

MenuStrip

  

Menustrip class is the Parent class for MUI's object oriented menus.

MenuItem

  

Menuitem class describes a single menu item.


Documentation generated on: 2024-11-21