Class TMenuItem
Unit
Declaration
type TMenuItem = class(TMenuEntryWithCaption)
Description
TMenuEntry that is a simple, clickable menu item. User expects that something will happend when he clicks on TMenuItem
. You can also specify key shortcuts for this menu item.
Hierarchy
- TObject
- TMenuEntry
- TMenuEntryWithCaption
- TMenuItem
Overview
Methods
function DoClick: boolean; virtual; |
|
function KeyToString(out S: string): boolean; |
|
function KeyMatches(const AKey: TKey; const AKeyString: String; const AModifiers: TModifierKeys): boolean; |
|
function CaptionWithKey: string; |
|
constructor Create(const ACaption: String; AIntData: Integer); overload; |
|
constructor Create(const ACaption: String; AIntData: Integer; AKeyString: String); overload; |
|
constructor Create(const ACaption: String; AIntData: Integer; AKey: TKey); overload; |
|
destructor Destroy; override; |
Properties
property IntData: Integer read FIntData write FIntData; |
|
property SmallId: Integer read FSmallId; |
|
property KeyString: String read FKeyString write FKeyString; |
|
property Key: TKey read FKey write FKey default keyNone; |
|
property CharKey: Char read GetCharKey write SetCharKey; deprecated 'use KeyString'; |
|
property Modifiers: TModifierKeys read FModifiers write FModifiers; |
Description
Methods
function DoClick: boolean; virtual; |
|
Called when this menu item will be choosen by user (by clicking, or pressing the matching key shortcut). You can override this and return true if you handled the event. If this will return false, CastleWindow will call EventMenuClick (OnMenuClick). When entering this method, current OpenGL context is set to the context of the window that the clicked menu belongs to. Default implementation of this method in this class always returns false. |
function KeyToString(out S: string): boolean; |
|
Returns as S the string that describes key shortcut (KeyString, Key, Modifiers) and then returns true. If KeyString = '' and Key = keyNone then returns false and S is undefined. |
function KeyMatches(const AKey: TKey; const AKeyString: String; const AModifiers: TModifierKeys): boolean; |
|
function CaptionWithKey: string; |
|
Caption with optional key description (returned by KeyString) appended. |
constructor Create(const ACaption: String; AIntData: Integer); overload; |
|
constructor Create(const ACaption: String; AIntData: Integer; AKeyString: String); overload; |
|
constructor Create(const ACaption: String; AIntData: Integer; AKey: TKey); overload; |
|
destructor Destroy; override; |
|
Properties
property IntData: Integer read FIntData write FIntData; |
|
An integer value, for any purpose you want. Useful to identify this item in TCastleWindow.OnMenuClick callback. |
property SmallId: Integer read FSmallId; |
|
Unique small identifier of this menu item. This is initialized at creation of this object, to be unique among all currently existing (created and not destroyed) TMenuItem instances. The intention is that this See also
|
property KeyString: String read FKeyString write FKeyString; |
|
Key shortcut for this menu item. When user presses indicated Key (if it's not keyNone) or Handling of menu key shortcuts is completely within the CastleWindow (usually, it's even done by the underlying backend like GTK or WinAPI). You will not get EventPress (OnPress) messages for keypresses that translate to menu clicks. Although TCastleWindow.Pressed.Keys will be still appropriately updated. Note that Caption of this object should not contain description of Key or You should use at most one of these properties, not both. So either use Key or The
The TODO: for now, this must be assigned before adding this menu item to parent (actually, before the parent menu is added to window MainMenu) to work reliably. Don't change this property afterwards. Usually, you will set this property by an argument to the constructor. |
property Key: TKey read FKey write FKey default keyNone; |
|
property CharKey: Char read GetCharKey write SetCharKey; deprecated 'use KeyString'; |
|
Warning: this symbol is deprecated: use KeyString |
property Modifiers: TModifierKeys read FModifiers write FModifiers; |
|
Note that KeyString may already indicate some TODO: for now, this must be assigned before adding this menu item to parent (actually, before the parent menu is added to window MainMenu) to work reliably. Don't change this property afterwards. |
Generated by PasDoc 0.16.0.