Class TGUIContextMenu

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TGUIContextMenu = class(TGUIElement)

Description

A GUI context menu.

Hierarchy

Overview

Methods

Public function AddItem(const Text: StringType; NCommandID: LongInt=-1; Enabled: Boolean = True; NHasSubMenu: Boolean = False; NChecked: Boolean = False; NAutoChecking: Boolean = False): LongWord; inline;
Public function FindItemWithCommandID(CommandID: LongInt; StartIndex: LongWord=0): LongInt; inline;
Public function GetItemAutoChecking(Index: LongWord): Boolean; inline;
Public function GetItemCommandID(Index: LongWord): LongInt; inline;
Public function GetItemText(Index: LongWord): StringType; inline;
Public function GetSubMenu(Index: LongWord): TGUIContextMenu; inline;
Public function InsertItem(Index: LongWord; const Text: StringType; NCommandID: LongInt=-1; Enabled: Boolean = True; NHasSubMenu: Boolean = False; NChecked: Boolean = False; NAutoChecking: Boolean = False): LongWord; inline;
Public function IsItemChecked(Index: LongWord): Boolean; inline;
Public function IsItemEnabled(Index: LongWord): Boolean; inline;
Public procedure AddSeparator; inline;
Public procedure RemoveAllItems; inline;
Public procedure RemoveItem(Index: LongWord); inline;
Public procedure SetEventParent(Parent: TGUIElement); inline;
Public procedure SetItemChecked(Index: LongWord; Enabled: Boolean); inline;
Public procedure SetItemCommandID(Index: LongWord; ID: LongInt); inline;
Public procedure SetItemEnabled(Index: LongWord; Enabled: Boolean); inline;
Public procedure SetItemText(Index: LongWord; const Text: StringType); inline;

Properties

Public property CloseAction: TGUIContextMenuCloseAction read GetCloseAction write SetCloseAction;
Public property ItemCount: LongWord read GetItemCount;
Public property SelectedItem: LongInt read GetSelectedItem;

Description

Methods

Public function AddItem(const Text: StringType; NCommandID: LongInt=-1; Enabled: Boolean = True; NHasSubMenu: Boolean = False; NChecked: Boolean = False; NAutoChecking: Boolean = False): LongWord; inline;

Adds a menu item.

Parameters
Text
Text of menu item. Set this to 0 to create an separator instead of a real item, which is the same like calling AddSeparator.
CommandId
Command id of menu item, a simple id you may set to whatever you want.
Enabled
Specifies if the menu item should be enabled.
HasSubMenu
Set this to true if there should be a submenu at this item. You can access this submenu via GetSubMenu
Checked
Specifies if the menu item should be initially checked.
AutoChecking
Specifies if the item should be checked by clicking.
Returns

he index of the new item.

Public function FindItemWithCommandID(CommandID: LongInt; StartIndex: LongWord=0): LongInt; inline;

Find an item by it's CommandID.

Parameters
CommandID
We are looking for the first item which has this CommandID.
StartIndex
Start searching from this index.
Returns

the index of the item when found or otherwise -1.

Public function GetItemAutoChecking(Index: LongWord): Boolean; inline;

Specifies whether the element changes its checked state when clicked.

Public function GetItemCommandID(Index: LongWord): LongInt; inline;

Returns the command ID of a menu item.

Parameters
Index
Zero based index of the menu item.
Public function GetItemText(Index: LongWord): StringType; inline;

Returns the visible caption of a menu item.

Parameters
Index
Zero based index of the menu item.
Public function GetSubMenu(Index: LongWord): TGUIContextMenu; inline;

Returns a submenu.

Parameters
Index
Zero based index of the menu item which contains the submenu.
Returns

The submenu or nil if there is no submenu.

Public function InsertItem(Index: LongWord; const Text: StringType; NCommandID: LongInt=-1; Enabled: Boolean = True; NHasSubMenu: Boolean = False; NChecked: Boolean = False; NAutoChecking: Boolean = False): LongWord; inline;

Insert a menu item at specified position.

Parameters
Index
Position to insert the new element, should be smaller than itemcount otherwise the item is added to the end.
Text
Text of menu item. Set this to 0 to create an separator instead of a real item, which is the same like calling AddSeparator.
NCommandID
Command id of menu item, a simple id you may set to whatever you want.
Enabled
Specifies if the menu item should be enabled.
NHasSubMenu
Set this to true if there should be a submenu at this item. You can access this submenu via GetSubMenu.
NChecked
Specifies if the menu item should be initially checked.
NAutoChecking
Specifies if the item should be checked by clicking.
Returns

The index of the new item.

Public function IsItemChecked(Index: LongWord): Boolean; inline;

Returns if a certain item is checked.

Public function IsItemEnabled(Index: LongWord): Boolean; inline;

Returns if a certain item is enabled.

Public procedure AddSeparator; inline;

Adds a separator item to the menu.

Public procedure RemoveAllItems; inline;

Removes all menu items.

Public procedure RemoveItem(Index: LongWord); inline;

Removes a single menu item.

Parameters
Index
Zero based index of the menu item.
Public procedure SetEventParent(Parent: TGUIElement); inline;

When an EventParent is set, it will receive events instead of the usual parent element.

Public procedure SetItemChecked(Index: LongWord; Enabled: Boolean); inline;

Modifies the checked state of a menu item.

Parameters
Index
Zero based index of the menu item.
Enabled
True if the item is to be checked, False otherwise.
Public procedure SetItemCommandID(Index: LongWord; ID: LongInt); inline;

Sets the command id of a menu item.

Parameters
Index
Zero based index of the menu item.
ID
The new command id.
Public procedure SetItemEnabled(Index: LongWord; Enabled: Boolean); inline;

Enables or disables a menu item.

Parameters
Index
Zero based index of the menu item.
Enabled
The new enabled state.
Public procedure SetItemText(Index: LongWord; const Text: StringType); inline;

Sets the visible caption of a menu item.

Parameters
Index
Zero based index of the menu item.
Text
The new caption.

Properties

Public property CloseAction: TGUIContextMenuCloseAction read GetCloseAction write SetCloseAction;

The closing behaviour of this menu.

Public property ItemCount: LongWord read GetItemCount;

The count of items currently in the meun.

Public property SelectedItem: LongInt read GetSelectedItem;

Contains the index of the currently selected item or -1 if none is selected.


Generated by PasDoc 0.12.1 on 2012-09-14 17:32:22