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
Menu(Widget parent)
def __init__(self, parent: Widget):
Create a menu bar inside parent.
| Parameter | Type | Description |
|---|---|---|
parent | Widget | Containing 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.
| Parameter | Type | Description |
|---|---|---|
header | string | Button text shown on the bar. |
subItems | string[] | Sub-item strings; null is treated as empty. |
itemWidth | int | Fixed 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.
| Parameter | Type | Description |
|---|---|---|
header | string | Button text shown on the bar. |
itemWidth | int | Fixed width in pixels; 0 fits the text. |
Returns MenuItem: Handle for subscribing to MenuItem.Clicked.