This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
A button used to display a menu
PtWidget --> PtBasic --> PtContainer --> PtCompound --> PtMenuButton
For more information, see the diagram of the widget hierarchy.
<photon/PtMenuButton.h>
The PtMenuButton class displays text or images with optional accelerator key text. Menu buttons are used to present menus from within menu bars or other menus.
A PtMenuButton widget.
If you want an accelerator key, set the Pt_ARG_ACCEL_KEY resource that's inherited from PtLabel. For example:
narg = 0; PtSetArg (&args [narg++], Pt_ARG_TEXT_STRING, "File", 0); PtSetArg (&args [narg++], Pt_ARG_ACCEL_KEY, "F", 0); PtCreateWidget (PtMenuButton, database.menu, narg, args);
Resource | C type | Pt type | Default |
---|---|---|---|
Pt_ARG_ACCEL_FONT | char * | String | "TextFont09b" |
Pt_ARG_ACCEL_TEXT | char * | String | "" |
Pt_ARG_BUTTON_TYPE | unsigned short | Scalar | Pt_MENU_TEXT |
Pt_ARG_MODIFIER_KEYS | ulong_t | Scalar | 0 |
Pt_ARG_OFFSET | unsigned short | Scalar | 0 |
These resources are actually defined in <photon/PtMenuLabel.h> for the PtMenuLabel widget, which you'll never instantiate on its own. |
C type | Pt type | Default |
---|---|---|
char * | String | "TextFont09b" |
The font used to render the hotkey accelerator text.
C type | Pt type | Default |
---|---|---|
char * | String | "" |
The text that identifies the hotkey that's bound to this widget.
C type | Pt type | Default |
---|---|---|
unsigned short | Scalar | Pt_MENU_TEXT |
The type of menu button; one of the following:
C type | Pt type | Default |
---|---|---|
ulong_t | Scalar | 0 |
The modifier key(s) to be displayed in the menu button, expressed as a bitwise OR of one or more of the Pk_KM_* flags defined in <photon/PkKeyDef.h>.
C type | Pt type | Default |
---|---|---|
unsigned short | Scalar | 0 |
The x offset used to render the accelerator text.
If the widget modifies an inherited resource, the "Default override" column indicates the new value. This modification affects any subclasses of the widget.