Skip to main content

Class: SoftKeyMenu

Defined in: src/garminsdk/softkey/SoftKeyMenu.ts:35

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.

Extended by​

Constructors​

Constructor​

new SoftKeyMenu(menuSystem): SoftKeyMenu

Defined in: src/garminsdk/softkey/SoftKeyMenu.ts:47

Creates an instance of a SoftKeyMenu.

Parameters​

ParameterTypeDescription
menuSystemSoftKeyMenuSystemThe menu system that will manage this menu.

Returns​

SoftKeyMenu

Properties​

protected menuSystem: SoftKeyMenuSystem

Defined in: src/garminsdk/softkey/SoftKeyMenu.ts:47

The menu system that will manage this menu.


SOFTKEY_COUNT​

readonly static SOFTKEY_COUNT: 12 = 12

Defined in: src/garminsdk/softkey/SoftKeyMenu.ts:38

The number of softkeys in each menu.

Methods​

addItem()​

addItem(index, label, handler?, value?, disabled?): SoftKeyMenuItem

Defined in: src/garminsdk/softkey/SoftKeyMenu.ts:59

Adds a menu item to the softkey menu.

Parameters​

ParameterTypeDefault valueDescription
indexnumberundefinedThe softkey index to add the menu item to. Must be between 0 and 11, inclusive.
labelstringundefinedThe label of the menu item.
handler?(menu) => voidundefinedThe handler to call when the menu item is selected.
value?string | booleanundefinedThe value of the menu item, if any.
disabled?booleanfalseWhether or not the menu item is disabled.

Returns​

SoftKeyMenuItem

The new menu item.

Throws​

Error if index is out of bounds.


destroy()​

destroy(): void

Defined in: src/garminsdk/softkey/SoftKeyMenu.ts:138

Destroys this menu.

Returns​

void


forEach()​

forEach(each): void

Defined in: src/garminsdk/softkey/SoftKeyMenu.ts:119

Iterates over the menu items.

Parameters​

ParameterTypeDescription
each(menuItem, index) => voidThe function to run over each menu item.

Returns​

void


getItem()​

getItem(index): SoftKeyMenuItem | null

Defined in: src/garminsdk/softkey/SoftKeyMenu.ts:100

Gets a menu item.

Parameters​

ParameterTypeDescription
indexnumberThe index of the menu item. Must be between 0 and 11, inclusive.

Returns​

SoftKeyMenuItem | null

The requested menu item.

Throws​

Error if index is out of bounds.


handleBack()​

handleBack(): void

Defined in: src/garminsdk/softkey/SoftKeyMenu.ts:111

Handles a back menu action.

Returns​

void


handleItemPressed()​

handleItemPressed(index): void

Defined in: src/garminsdk/softkey/SoftKeyMenu.ts:127

Handles when a menu item is pressed.

Parameters​

ParameterTypeDescription
indexnumberThe index of the menu item that was pressed.

Returns​

void


removeItem()​

removeItem(index): void

Defined in: src/garminsdk/softkey/SoftKeyMenu.ts:86

Removes a menu item from the menu.

Parameters​

ParameterTypeDescription
indexnumberThe 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.