Class TMenuItemRadio
Unit
Declaration
type TMenuItemRadio = class(TMenuItemChecked)
Description
Menu radio item. Similar to TMenuItemChecked, but it belongs to a group and within this group only one (or none) radio button can be checked.
Note that AutoCheckedToggle property has a little different meaning in this class: whenever user will click on some item, it will be automatically set to Checked = True and the rest of items within this group will be set to Checked = False.
You can of course operate on Checked property explicitly, setting it to True or False.
Source: window/castlewindowmenu.inc (line 371).
Hierarchy
- TObject
- TMenuEntry
- TMenuEntryWithCaption
- TMenuItem
- TMenuItemChecked
- TMenuItemRadio
Overview
Methods
| Protected | procedure ClearHandles; virtual; |
| Public | procedure MenuUpdateBegin; |
| Public | procedure MenuUpdateEnd; |
| Public | constructor Create(const ACaption: String); |
| Public | function DoClick: boolean; virtual; |
| Public | function KeyToString(out S: string): boolean; |
| Public | function KeyMatches(const AKey: TKey; const AKeyString: String; const AModifiers: TModifierKeys): boolean; |
| Public | function CaptionWithKey: string; |
| Public | constructor Create(const ACaption: String; AIntData: Integer); overload; |
| Public | constructor Create(const ACaption: String; AIntData: Integer; AKeyString: String); overload; |
| Public | constructor Create(const ACaption: String; AIntData: Integer; AKey: TKey); overload; |
| Public | destructor Destroy; override; |
| Protected | procedure SetChecked(Value: boolean); virtual; |
| Protected | procedure DoAutoCheckedToggle; virtual; |
| Public | function DoClick: boolean; override; |
| Public | constructor Create(const ACaption: String; AIntData: Integer; AChecked, AAutoCheckedToggle: boolean); overload; |
| Public | constructor Create(const ACaption: String; AIntData: Integer; const AKeyString: String; AChecked, AAutoCheckedToggle: boolean); overload; |
| Public | constructor Create(const ACaption: String; AIntData: Integer; AKey: TKey; AChecked, AAutoCheckedToggle: boolean); overload; |
| Protected | procedure SetChecked(Value: boolean); override; |
| Protected | procedure DoAutoCheckedToggle; override; |
| Public | constructor Create(const ACaption: String; AIntData: Integer; AChecked, AAutoCheckedToggle: boolean); overload; |
| Public | constructor Create(const ACaption: String; AIntData: Integer; const AKeyString: String; AChecked, AAutoCheckedToggle: boolean); overload; |
| Public | constructor Create(const ACaption: String; AIntData: Integer; AKey: TKey; AChecked, AAutoCheckedToggle: boolean); overload; |
| Public | destructor Destroy; override; |
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 IntData: Integer read FIntData write FIntData; |
| Public | property SmallId: Integer read FSmallId; |
| Public | property KeyString: String read FKeyString write FKeyString; |
| Public | property Key: TKey read FKey write FKey default keyNone; |
| Public | property CharKey: Char read GetCharKey write SetCharKey; deprecated 'use KeyString'; |
| Public | property Modifiers: TModifierKeys read FModifiers write FModifiers; |
| Public | property Checked: boolean read FChecked write SetChecked; |
| Public | property AutoCheckedToggle: boolean read FAutoCheckedToggle
write FAutoCheckedToggle; |
| Public | property Group: TMenuItemRadioGroup read FGroup write SetGroup; |
Description
Methods
| Protected | procedure ClearHandles; virtual; |
|
Recursively clear TMenuEntry.Handle values. | |
| Public | procedure MenuUpdateBegin; |
|
For optimization purposes, you may surround many menu changes inside | |
| Public | procedure MenuUpdateEnd; |
|
This item has no description. | |
| Public | constructor Create(const ACaption: String); |
|
This item has no description. | |
| Public | 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. | |
| Public | 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. | |
| Public | function KeyMatches(const AKey: TKey; const AKeyString: String; const AModifiers: TModifierKeys): boolean; |
|
This item has no description. | |
| Public | function CaptionWithKey: string; |
|
Caption with optional key description (returned by KeyString) appended. | |
| Public | constructor Create(const ACaption: String; AIntData: Integer); overload; |
|
This item has no description. | |
| Public | constructor Create(const ACaption: String; AIntData: Integer; AKeyString: String); overload; |
|
This item has no description. | |
| Public | constructor Create(const ACaption: String; AIntData: Integer; AKey: TKey); overload; |
|
This item has no description. | |
| Public | destructor Destroy; override; |
|
This item has no description. | |
| Protected | procedure SetChecked(Value: boolean); virtual; |
|
Called when Checked property is assigned. | |
| Protected | procedure DoAutoCheckedToggle; virtual; |
|
Called from DoClick when AutoCheckedToggle is Note that this is overriden ina a "dirty" way (i.e. not calling "inherited") in TMenuItemRadio descendant. | |
| Public | function DoClick: boolean; override; |
|
Overriden to handle AutoCheckedToggle. In this class, | |
| Public | constructor Create(const ACaption: String; AIntData: Integer; AChecked, AAutoCheckedToggle: boolean); overload; |
|
This item has no description. | |
| Public | constructor Create(const ACaption: String; AIntData: Integer; const AKeyString: String; AChecked, AAutoCheckedToggle: boolean); overload; |
|
This item has no description. | |
| Public | constructor Create(const ACaption: String; AIntData: Integer; AKey: TKey; AChecked, AAutoCheckedToggle: boolean); overload; |
|
This item has no description. | |
| Protected | procedure SetChecked(Value: boolean); override; |
|
This item has no description. Showing description inherited from TMenuItemChecked.SetChecked. Called when Checked property is assigned. | |
| Protected | procedure DoAutoCheckedToggle; override; |
|
This item has no description. Showing description inherited from TMenuItemChecked.DoAutoCheckedToggle.
Called from DoClick when AutoCheckedToggle is Note that this is overriden ina a "dirty" way (i.e. not calling "inherited") in TMenuItemRadio descendant. | |
| Public | constructor Create(const ACaption: String; AIntData: Integer; AChecked, AAutoCheckedToggle: boolean); overload; |
|
This item has no description. | |
| Public | constructor Create(const ACaption: String; AIntData: Integer; const AKeyString: String; AChecked, AAutoCheckedToggle: boolean); overload; |
|
This item has no description. | |
| Public | constructor Create(const ACaption: String; AIntData: Integer; AKey: TKey; AChecked, AAutoCheckedToggle: boolean); overload; |
|
This item has no description. | |
| Public | destructor Destroy; override; |
|
This item has no description. | |
Properties
| Public | property ParentMenu: TMenu read FParentMenu; |
|
This is the parent TMenu that has this item in it's Entries list. | |
| Public | property ParentMenuPosition: Cardinal read FParentMenuPosition; |
|
Position on ParentMenu. Indexed from 0, so ParentMenu.Entries[ | |
| Public | property Caption: String read FCaption write SetCaption; |
|
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. | |
| Public | property Enabled: boolean read FEnabled write SetEnabled
default true; |
|
This item has no description. | |
| Public | property IntData: Integer read FIntData write FIntData; |
|
An integer value, for any purpose you want. Useful to identify this item in TCastleWindow.OnMenuClick callback. | |
| Public | 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
| |
| Public | 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. | |
| Public | property Key: TKey read FKey write FKey default keyNone; |
|
This item has no description. | |
| Public | property CharKey: Char read GetCharKey write SetCharKey; deprecated 'use KeyString'; |
|
Warning: this symbol is deprecated: use KeyString This item has no description. | |
| Public | property Modifiers: TModifierKeys read FModifiers write FModifiers; |
|
Modifiers (shift, ctrl and such) required to activate this menu item. These have to be pressed along with Key or KeyString. Note that KeyString may already indicate some modifiers, if it's one of the CtrlA ... CtrlZ then the Ctrl key is required and if it's an uppercase letter then the Shift key is required. There's no need to include this modifier in this property then. 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. | |
| Public | property Checked: boolean read FChecked write SetChecked; |
|
This item has no description. | |
| Public | property AutoCheckedToggle: boolean read FAutoCheckedToggle
write FAutoCheckedToggle; |
|
If | |
| Public | property Group: TMenuItemRadioGroup read FGroup write SetGroup; |
|
The list of radio items within this group. This is never Assigning this property is equivalent to adding yourself to the wanted group. I.e. | |
Generated by PasDoc 0.17.0.snapshot.