Class TMenu

Unit

Declaration

type TMenu = class(TMenuEntryWithCaption)

Description

TMenuEntry that contains a list of menu entries. This is the basic class to represent a drop-down menu, a submenu etc.

Source: window/castlewindowmenu.inc (line 123).

Hierarchy

Show Additional Members:

Overview

Methods

Public procedure MenuUpdateBegin;
Public procedure MenuUpdateEnd;
Protected procedure ClearHandles; override;
Public constructor Create(const ACaption: String);
Public destructor Destroy; override;
Public function Count: Integer;
Public procedure Insert(Index: Integer; Value: TMenuEntry);
Public procedure Append(Value: TMenuEntry);
Public procedure Delete(Index: Integer);
Public procedure Clear;
Public function EntriesCount: Integer; deprecated;
Public procedure EntryDelete(Index: Integer); deprecated;
Public procedure EntriesDeleteAll; deprecated;
Public procedure DeleteAll;
Public function AppendRadioGroup(const Items: array of string; BaseIntData: Cardinal; SelectedIndex: Integer; AAutoCheckedToggle: boolean; QuoteCaption: boolean = true): TMenuItemRadioGroup;

Properties

Public property ParentMenu: TMenu read FParentMenu;
Public property ParentMenuPosition: Cardinal read FParentMenuPosition;
Public property Caption: String read FCaption write SetCaption;
Public property Enabled: boolean read FEnabled write SetEnabled default true;
Public property Entries [Index: Integer]: TMenuEntry read GetEntries; default;

Description

Methods

Public procedure MenuUpdateBegin;

This item is declared in ancestor TMenuEntry.

For optimization purposes, you may surround many menu changes inside MenuUpdateBegin + MenuUpdateEnd calls. Make sure window is not closed / opened between them.

Source: window/castlewindowmenu.inc (line 62).

Public procedure MenuUpdateEnd;

This item is declared in ancestor TMenuEntry.

This item has no description.

Source: window/castlewindowmenu.inc (line 63).

Protected procedure ClearHandles; override;

This item has no description. Showing description inherited from TMenuEntry.ClearHandles.

Recursively clear TMenuEntry.Handle values.

Source: window/castlewindowmenu.inc (line 128).

Public constructor Create(const ACaption: String);

This item has no description.

Source: window/castlewindowmenu.inc (line 130).

Public destructor Destroy; override;

This item has no description.

Source: window/castlewindowmenu.inc (line 131).

Public function Count: Integer;

This item has no description.

Source: window/castlewindowmenu.inc (line 136).

Public procedure Insert(Index: Integer; Value: TMenuEntry);

This item has no description.

Source: window/castlewindowmenu.inc (line 137).

Public procedure Append(Value: TMenuEntry);

Add at the end. Same as Insert(Count, Value).

Source: window/castlewindowmenu.inc (line 139).

Public procedure Delete(Index: Integer);

This item has no description.

Source: window/castlewindowmenu.inc (line 140).

Public procedure Clear;

This item has no description.

Source: window/castlewindowmenu.inc (line 141).

Public function EntriesCount: Integer; deprecated;

Warning: this symbol is deprecated.

Deprecated name for Count.

Source: window/castlewindowmenu.inc (line 144).

Public procedure EntryDelete(Index: Integer); deprecated;

Warning: this symbol is deprecated.

Deprecated name for Delete.

Source: window/castlewindowmenu.inc (line 146).

Public procedure EntriesDeleteAll; deprecated;

Warning: this symbol is deprecated.

Deprecated name for Clear.

Source: window/castlewindowmenu.inc (line 148).

Public procedure DeleteAll;

Warning: this symbol is deprecated.

Deprecated name for Clear.

Source: window/castlewindowmenu.inc (line 150).

Public function AppendRadioGroup(const Items: array of string; BaseIntData: Cardinal; SelectedIndex: Integer; AAutoCheckedToggle: boolean; QuoteCaption: boolean = true): TMenuItemRadioGroup;

Append a number of radio menu items. This is a comfortable shortcut for an often task of adding many TMenuItemRadio items that create a new radio group (TMenuItemRadioGroup).

For each item of Items list, we'll add a new TMenuItemRadio instance.

  • TMenuItemRadio.Caption will be set to the Items[I] string. Additionally it will be quoted by SQuoteMenuEntryCaption to avoid interpreting underscore characters (if QuoteCaption).

  • TMenuItemRadio.IntData will be set to BaseIntData + the number of this item. (This is usually most comfortable, you can handle this radio group by "case" with a range.)

  • TMenuItemRadio.Group will be equal. More precisely: along with creating the first TMenuItemRadio, we will also create new TMenuItemRadioGroup. For the rest of TMenuItemRadio, we'll assign this group.

  • TMenuItemRadio.Checked will be set to True on only one item: the one numbered SelectedIndex. Pass SelectedIndex negative (or >= than items count) to have no radio item checked by default.

  • TMenuItemRadio.AutoCheckedToggle will be set according to ou parameter AAutoCheckedToggle.

We return the newly created TMenuItemRadioGroup. If Items is empty, this does nothing and returns Nil.

Source: window/castlewindowmenu.inc (line 185).

Properties

Public property ParentMenu: TMenu read FParentMenu;

This item is declared in ancestor TMenuEntry.

This is the parent TMenu that has this item in it's Entries list. Nil is there is not parent menu yet (e.g. because it's not assigned yet, or because this is the main menu).

Source: window/castlewindowmenu.inc (line 69).

Public property ParentMenuPosition: Cardinal read FParentMenuPosition;

This item is declared in ancestor TMenuEntry.

Position on ParentMenu. Indexed from 0, so ParentMenu.Entries[ParentMenuPosition] should be always equal to Self (as long as ParentMenu <> Nil.

Source: window/castlewindowmenu.inc (line 74).

Public property Caption: String read FCaption write SetCaption;

This item is declared in ancestor TMenuEntryWithCaption.

Caption of this menu entry. Will be shown to user.

To indicate that some letter of a caption is a mnemonic for this menu item put '_' (underscore) char before this letter. Depending on CastleWindow-backend-dependent, mnemonics should allow user to easier activate this menu item with keyboard (e.g. Alt+mnemonic to dropdown item in MainMenu).

You can put two consecutive underscore chars in Caption to indicate that here Caption should display literally one underscore character.

(Convention to mark mnemonics with '_' is just copied from gtk, from gtk_label_new_with_mnemonic. So no, I didn't invent another new convention here.)

It is undefined what will happen if you put underscore chars before *two* or more letters in Caption. I.e. you can't define multiple mnemonics for one menu item. I.e. this will not crash your program, but results may be CastleWindow-backend-dependent.

Just like in GTK toolkit gtk_label_new_with_mnemonic and gtk_menu_item_new_with_mnemonic.

Source: window/castlewindowmenu.inc (line 113).

Public property Enabled: boolean read FEnabled write SetEnabled default true;

This item is declared in ancestor TMenuEntryWithCaption.

This item has no description.

Source: window/castlewindowmenu.inc (line 115).

Public property Entries [Index: Integer]: TMenuEntry read GetEntries; default;

Items (entries) on the menu. Items are owned by this menu instance (are automatically freed at destruction, at Delete and such).

Source: window/castlewindowmenu.inc (line 135).


Generated by PasDoc 0.17.0.snapshot.