You may return to the Cvo Object Documenation Index from this document. This document contains the following sections describing the Cvo_MenuLabel object:
Cvo_MenuLabel
Cvo_Window
The Cvo_MenuLabel object is used to display an entry in a menu, such as the Cvo_Menu object. It is created by each object as needed, and therefore it should never need to be explicitly created. The Cvo_MenuLabel object can provide a small toggle button to the left when required. It can also provide an arrow to the right, for a cascade menu, when required.
The label text provided for this object, whether in a resource, or
via the SetText()
or SetDefaultText()
member functions, will be
parsed for a quick key and an accelerator.
A quick key is a key which can cause this label to be selected immediately, when the menu is displayed. It is designated with an underbar before it. Quick keys should be unique on menus. Quick keys are not case sensitive.
An accelerator is a combination of keystrokes which can cause this label to selected, and its associated action taken, whether or not the menu it is on has been displayed. The accelerator is designated by a trailing portion of the label text, preceded by a plus (+) character. Accelerators should be unique in an application. The rules for an accelerator are documented with the Cvo_Accelerator object.
For instance, the label text "_Toggle + <CTRL-T>" will cause the Cvo_MenuLabel object to display "Toggle" as the label text. The "T" key, when pressed, will cause this menu item to be selected. If the "Control-T" key combination is pressed, regardless of whether or not the menu is displayed, then this menu item will be selected.
This object defines the following member functions in addition to those defined by its parent and ancestor objects.
SetText (
[ char | wchar_t ] *text )
This function sets the text which will appear as the label, as well as the quick key and the accelerator.
SetDefaultText (
[ char | wchar_t ] *text )
This function sets the text which will appear as the label, as well as the quick key and the accelerator, if there is no other text previously set as the label.
Selected (
)
This function simulates what happens when a user selects this menu entry. This only has an affect when the menu entry is of a toggle type.
ForceOn (
)
ForceOff (
)
These functions simulate what happens when a user toggles on or off a toggle type menu entry. This only has an affect when the menu entry is of a toggle type.
GetText (
Cvo_CharacterBuffer &buf )
This function returns, in buf, the label text for this object. This label text will include the quick key, and the accelerator, if such have been given.
Compact (
BOOL flag )
By default, this object will reserve space to the left of a menu entry label for a toggle button, whether or not this entry is a toggle entry. This permits all text in a menu to line up. This function disables that behavior, such that if there is no toggle associated with this menu entry, then the label text will be left justified in the menu.
wchar_t Accelerator (
)
wchar_t *QuickKey (
)
These functions return the quick key and the accelerator for the menu
entry, respectively, or a NULL
value if they have not been set.
This object defines the following Cvo Events in addition to those defined by its parent and ancestor objects.
CvoButtonUpEvent
struct
Cvo_ButtonEvent
CvoButtonDownEvent
struct
Cvo_ButtonEvent
Documentation on these events is available in the Cvo_BasicButton object documentation.
This object uses the following X resources in addition to those used by its parent and ancestor objects.
*CvoMenuLabel.acceleratorGap
(class:
AcceleratorGap
) (default value:
20
)
This resource gives the number of pixels which should be between the accelerator and the text displayed in the Cvo_MenuLabel.
*CvoMenuLabel.label
(class:
Label
) (default value:
Menu
)
This resource gives the text to display in the Cvo_MenuLabel. This text should also include the accelerator, if any.
This object modifies the following X resources which are used by its parent or other ancestors.
*CvoMenuLabel*FontFamily
(new value:
Helvetica
)
*CvoMenuLabel*TabStop
(new value:
8
)
*CvoMenuLabel*FontWeight
(new value:
Bold
)
See the example source code for an example of how to use this object.
See the legend for information about the conventions used in this documentation.