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 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 | function DoClick: boolean; override; |
| 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; |
|
This item is declared in ancestor TMenuEntry. Recursively clear TMenuEntry.Handle values. | |
| Public | procedure MenuUpdateBegin; |
|
This item is declared in ancestor TMenuEntry.
For optimization purposes, you may surround many menu changes inside | |
| Public | procedure MenuUpdateEnd; |
|
This item is declared in ancestor TMenuEntry. This item has no description. | |
| Public | constructor Create(const ACaption: String); |
|
This item is declared in ancestor TMenuEntryWithCaption. This item has no description. | |
| Public | function KeyToString(out S: string): boolean; |
|
This item is declared in ancestor TMenuItem. 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 is declared in ancestor TMenuItem. This item has no description. | |
| Public | function CaptionWithKey: string; |
|
This item is declared in ancestor TMenuItem. Caption with optional key description (returned by KeyString) appended. | |
| Public | constructor Create(const ACaption: String; AIntData: Integer); overload; |
|
This item is declared in ancestor TMenuItem. This item has no description. | |
| Public | constructor Create(const ACaption: String; AIntData: Integer; AKeyString: String); overload; |
|
This item is declared in ancestor TMenuItem. This item has no description. | |
| Public | constructor Create(const ACaption: String; AIntData: Integer; AKey: TKey); overload; |
|
This item is declared in ancestor TMenuItem. This item has no description. | |
| Public | function DoClick: boolean; override; |
|
This item is declared in ancestor TMenuItemChecked.
Overriden to handle AutoCheckedToggle. In this class, | |
| 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 item is declared in ancestor TMenuEntry.
This is the parent TMenu that has this item in it's Entries list. | |
| Public | property ParentMenuPosition: Cardinal read FParentMenuPosition; |
|
This item is declared in ancestor TMenuEntry.
Position on ParentMenu. Indexed from 0, so ParentMenu.Entries[ | |
| 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. | |
| Public | property Enabled: boolean read FEnabled write SetEnabled
default true; |
|
This item is declared in ancestor TMenuEntryWithCaption. This item has no description. | |
| Public | property IntData: Integer read FIntData write FIntData; |
|
This item is declared in ancestor TMenuItem. An integer value, for any purpose you want. Useful to identify this item in TCastleWindow.OnMenuClick callback. | |
| Public | property SmallId: Integer read FSmallId; |
|
This item is declared in ancestor TMenuItem. 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; |
|
This item is declared in ancestor TMenuItem. 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 is declared in ancestor TMenuItem. This item has no description. | |
| Public | property CharKey: Char read GetCharKey write SetCharKey; deprecated 'use KeyString'; |
|
This item is declared in ancestor TMenuItem. Warning: this symbol is deprecated: use KeyString This item has no description. | |
| Public | property Modifiers: TModifierKeys read FModifiers write FModifiers; |
|
This item is declared in ancestor TMenuItem. 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 is declared in ancestor TMenuItemChecked. This item has no description. | |
| Public | property AutoCheckedToggle: boolean read FAutoCheckedToggle
write FAutoCheckedToggle; |
|
This item is declared in ancestor TMenuItemChecked.
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.