Skip to main content

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

NameTypeDescription
menuSystemSoftKeyMenuSystemThe menu system that will manage this menu.

Returns

SoftKeyMenu

Defined in

src/garminsdk/softkey/SoftKeyMenu.ts:45

Properties

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

NameTypeDefault 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: SoftKeyMenu) => voidundefinedThe handler to call when the menu item is selected.
value?string | booleanundefinedThe value of the menu item, if any.
disabledbooleanfalseWhether or not the menu item is disabled.

Returns

SoftKeyMenuItem

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

NameTypeDescription
each(menuItem: null | SoftKeyMenuItem, index: number) => voidThe 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

NameTypeDescription
indexnumberThe 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

NameTypeDescription
indexnumberThe 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

NameTypeDescription
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.

Defined in

src/garminsdk/softkey/SoftKeyMenu.ts:83