Class: SoftKeyMenu
A Garmin softkey menu. Each menu contains up to 12 indexed menu items, each of which defines the display and behavior of a corresponding softkey.
Constructors
constructor
• new SoftKeyMenu(menuSystem
): SoftKeyMenu
Creates an instance of a SoftKeyMenu.
Parameters
Name | Type | Description |
---|---|---|
menuSystem | SoftKeyMenuSystem | The menu system that will manage this menu. |
Returns
Defined in
src/garminsdk/softkey/SoftKeyMenu.ts:45
Properties
menuSystem
• Protected
menuSystem: SoftKeyMenuSystem
The menu system that will manage this menu.
Defined in
src/garminsdk/softkey/SoftKeyMenu.ts:45
SOFTKEY_COUNT
▪ Static
Readonly
SOFTKEY_COUNT: 12
The number of softkeys in each menu.
Defined in
src/garminsdk/softkey/SoftKeyMenu.ts:36
Methods
addItem
▸ addItem(index
, label
, handler?
, value?
, disabled?
): SoftKeyMenuItem
Adds a menu item to the softkey menu.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
index | number | undefined | The softkey index to add the menu item to. Must be between 0 and 11, inclusive. |
label | string | undefined | The label of the menu item. |
handler? | (menu : SoftKeyMenu ) => void | undefined | The handler to call when the menu item is selected. |
value? | string | boolean | undefined | The value of the menu item, if any. |
disabled | boolean | false | Whether or not the menu item is disabled. |
Returns
The new menu item.
Throws
Error if index
is out of bounds.
Defined in
src/garminsdk/softkey/SoftKeyMenu.ts:57
destroy
▸ destroy(): void
Destroys this menu.
Returns
void
Defined in
src/garminsdk/softkey/SoftKeyMenu.ts:135
forEach
▸ forEach(each
): void
Iterates over the menu items.
Parameters
Name | Type | Description |
---|---|---|
each | (menuItem : null | SoftKeyMenuItem , index : number ) => void | The function to run over each menu item. |
Returns
void
Defined in
src/garminsdk/softkey/SoftKeyMenu.ts:116
getItem
▸ getItem(index
): null
| SoftKeyMenuItem
Gets a menu item.
Parameters
Name | Type | Description |
---|---|---|
index | number | The index of the menu item. Must be between 0 and 11, inclusive. |
Returns
null
| SoftKeyMenuItem
The requested menu item.
Throws
Error if index
is out of bounds.
Defined in
src/garminsdk/softkey/SoftKeyMenu.ts:97
handleBack
▸ handleBack(): void
Handles a back menu action.
Returns
void
Defined in
src/garminsdk/softkey/SoftKeyMenu.ts:108
handleItemPressed
▸ handleItemPressed(index
): void
Handles when a menu item is pressed.
Parameters
Name | Type | Description |
---|---|---|
index | number | The index of the menu item that was pressed. |
Returns
void
Defined in
src/garminsdk/softkey/SoftKeyMenu.ts:124
removeItem
▸ removeItem(index
): void
Removes a menu item from the menu.
Parameters
Name | Type | Description |
---|---|---|
index | number | The softkey index to remove the menu item from. Must be between 0 and 11, inclusive. |
Returns
void
Throws
Error if index
is out of bounds.
Defined in
src/garminsdk/softkey/SoftKeyMenu.ts:83