Skip to main content

Menu Class

Package: GHIElectronics.Endpoint.UI
Namespace: GHIElectronics.Endpoint.UI

Horizontal menu bar. Menu.AddItem returns a leaf-item handle; Menu.AddDropdown returns a dropdown handle whose entries are listed on click.

class Menu(Widget): ...

Constructors​

def __init__(self, parent: Widget):

Create a menu bar inside parent.

ParameterTypeDescription
parentWidgetContaining widget.

Properties​

Background​

Background: int # @property / @setter

Menu-bar background color as 0x00RRGGBB. Getter returns the last value set.

Returns uint

Methods​

AddDropdown(string header, string[] subItems, int itemWidth)​

def AddDropdown(self, header: str, subItems: list[str], itemWidth: int) -> MenuItem:

Append a dropdown menu item that opens a sub-list when tapped.

ParameterTypeDescription
headerstringButton text shown on the bar.
subItemsstring[]Sub-item strings; null is treated as empty.
itemWidthintFixed width in pixels; 0 fits the text.

Returns MenuItem: Handle for subscribing to MenuItem.ValueChanged and reading MenuItem.Selected.

AddItem(string header, int itemWidth)​

def AddItem(self, header: str, itemWidth: int) -> MenuItem:

Append a leaf menu item.

ParameterTypeDescription
headerstringButton text shown on the bar.
itemWidthintFixed width in pixels; 0 fits the text.

Returns MenuItem: Handle for subscribing to MenuItem.Clicked.