Navigation
Navigation controls move users between views, sections, and commands.
Controls And Helpers
| Control/helper | Use it for | Emits events |
|---|---|---|
MuiTabs |
Tabbed page switching. | MUI_EVENT_TAB_CHANGED |
MuiAccordion |
Collapsible sections. | MUI_EVENT_EXPANDED_CHANGED |
MuiAccordionItem |
One accordion section. | Through parent accordion |
MuiToolbar |
Command strip with buttons/separators/stretch. | MUI_EVENT_TOOLBAR_COMMAND |
MuiMenu |
Menu panel used by dropdown and context menu flows. | MUI_EVENT_MENU_ITEM when a row is picked |
MuiContextMenu |
Static context menu service. | MUI_EVENT_MENU_ITEM |
MuiDropdown |
Button-style dropdown selection. | MUI_EVENT_SELECTION_CHANGED |
Event Fields
| Event | Useful fields |
|---|---|
MUI_EVENT_TAB_CHANGED |
Index(), OldIndex(), Text() |
MUI_EVENT_EXPANDED_CHANGED |
Index(), Expanded(), Text() |
MUI_EVENT_TOOLBAR_COMMAND |
CommandId(), Value(), Text() |
MUI_EVENT_SELECTION_CHANGED |
Index(), OldIndex(), Text() |
MUI_EVENT_MENU_ITEM |
Index(), Text() |
App-level events require .Id(...) ≥ 0 (or explicit context-menu controlId). See Event Bus.
MuiTabs
Purpose
Tabbed container with a header strip and one visible page at a time. Owns tab header buttons and page elements added through AddTab.
Source: Controls/Navigation/Tabs.mqh.
Create It
MuiTabs *tabs=Mui::Tabs(parent);
tabs.Id(APP_NAV_TABS);
tabs.AddTab("General", generalPage);
tabs.AddTab("Risk", riskPage);
Also: Mui::TabsWithSegmentDividers, Mui::TabsFromNames (returns MuiTabsBundle), MuiCreate::Tabs(parent, x, y, w, h).
AddTab / AddTabIcon / AddTabIconEx take ownership of the page element.
Events
| Event | When it fires | Useful fields |
|---|---|---|
MUI_EVENT_TAB_CHANGED |
User clicks a tab header (Select(..., userInteraction=true)) |
ControlId(), Index(), OldIndex(), Value() (index), Text() (tab title) |
Selected(root, idx) calls Select with userInteraction=false and does not emit the event bus event.
Common Setters
| Setter | Purpose |
|---|---|
.AddTab(title, page) / .AddTabIcon(...) |
Add tab + owned page. |
.Selected(root, index) |
Programmatic tab switch (no bus event). |
.HeaderMode(0|1) |
0 = top horizontal, 1 = left vertical. |
.HeaderSize(...), .ItemSize(...) |
Header strip dimensions. |
.TabSegmentDividers(...), .TabDividerInset(...), .TabDividerColor(...) |
Segment divider styling. |
.Id(...), .SetFixedSize(...), .FullWidth(...) |
Routing and layout. |
.SetHandler(MuiTabChangedHandler*) |
Legacy owned handler. |
Common Reads
| Getter | Purpose |
|---|---|
.Selected() |
Active tab index. |
Example
if(event.EventId()==MUI_EVENT_TAB_CHANGED && event.ControlId()==APP_NAV_TABS)
{
const int tab=event.Index();
const string title=event.Text();
}
Related
MuiAccordion
Purpose
Vertical list of collapsible sections. Each section is a MuiAccordionItem with a header and owned body container.
Source: Controls/Navigation/Accordion.mqh.
Create It
MuiAccordion *acc=Mui::Accordion(parent);
acc.Id(APP_NAV_ACCORDION);
MuiAccordionItem *risk=acc.AddSection("Risk",true);
Mui::LabeledSpinEdit(risk.Body(),"Risk %",0.1,10.0,0.1,1.0);
MuiCreate::Accordion(parent, x, y, w, h) for explicit bounds.
Events
| Event | When it fires | Useful fields |
|---|---|---|
MUI_EVENT_EXPANDED_CHANGED |
User toggles a section header | ControlId(), Index() (section index), Expanded(), Value() (1 expanded / 0 collapsed), Text() (section title) |
Programmatic MuiAccordionItem::Expanded(...) does not emit the bus event.
Common Setters (accordion)
| Setter | Purpose |
|---|---|
.AddSection(title, expanded) |
Create section; returns MuiAccordionItem*. |
.Spacing(...), .DefaultHeaderHeight(...), .DefaultPad(...) |
Section layout defaults. |
.Id(...) on accordion |
Event routing ID. |
.SetExpandedChangedHandler(...) |
Non-owned intent handler. |
Common Setters (section item)
| Setter | Purpose |
|---|---|
.Title(...), .Expanded(...), .Body() / .Add(child) |
Section content. |
.LeftIcon(...), .HeaderHeight(...), .Pad(...) |
Header chrome. |
.SetOnToggle(MuiAccordionToggleHandler*) |
Legacy per-section handler. |
Example
if(event.EventId()==MUI_EVENT_EXPANDED_CHANGED && event.ControlId()==APP_NAV_ACCORDION)
{
const bool open=event.Expanded();
const int section=event.Index();
}
Related
MuiToolbar
Purpose
Horizontal command bar with themed chrome: text/icon buttons, labels, separators, and flex spacer slots.
Source: Controls/Navigation/Toolbar.mqh.
Create It
MuiToolbar *tb=MuiCreate::Toolbar(parent,0,0,parentWidth,40.0);
tb.Id(APP_NAV_TOOLBAR);
const int ixSave=tb.AddButton("save","Save",NULL,MUI_TOOLBAR_PRIMARY);
MuiButtonAction *btn=(MuiButtonAction*)tb.ChildAt(ixSave);
btn.Id(APP_CMD_SAVE);
tb.AddSpacer();
tb.AddButton("help","Help",NULL);
MuiCreate::Toolbar only — there is no Mui::Toolbar fast helper.
Events
| Event | When it fires | Useful fields |
|---|---|---|
MUI_EVENT_TOOLBAR_COMMAND |
Toolbar button click (after relay) | ControlId() (button .Id(), not toolbar ID), CommandId() (string id from AddButton), Text() (button caption), Value() (UserValue() on button), Sender() (button) |
Route by event.CommandId() when you use stable command strings, or by event.ControlId() when each toolbar button has its own .Id(...).
Common Setters
| Setter | Purpose |
|---|---|
.AddButton(id, text, handler, variant) |
Text button; id becomes CommandId(). |
.AddButton(id, icon, text, ...) / .AddIconButton(...) |
Icon variants. |
.AddLabel(id, text), .AddSeparator(), .AddSpacer() |
Non-command slots. |
.Compact(...), .ShowSeparators(...), padding/colour overrides |
Toolbar chrome. |
.SetCommandClickedHandler(...) |
Non-owned intent handler. |
Notes
- Each
AddButtoncreates aMuiButtonActionwith an internalMuiToolbarCmdRelayhandler. - Assign
.Id(...)on individual buttons when usingControlId()inOnMuiEvent.
Example
if(event.EventId()==MUI_EVENT_TOOLBAR_COMMAND)
{
if(event.CommandId()=="save")
SaveSettings();
}
Related
MuiMenu
Purpose
Scrollable menu panel of clickable rows. Used internally by MuiDropdown and MuiComboBoxHost, and by MuiContextMenu::Show for standalone menus.
Source: Controls/Navigation/Menu.mqh.
Create It
Menus are usually created by overlay helpers rather than added to a normal page:
string items[];
ArrayResize(items,2);
items[0]="Edit";
items[1]="Remove";
MuiContextMenu::Show(root,x,y,items,NULL,220.0,true,240.0,true,APP_CTX_MENU,NULL);
For manual menus: new MuiMenu(), menu.Build(items), place on overlay (see MuiDropdown::OpenMenu in source).
Events
| Event | When it fires | Useful fields |
|---|---|---|
MUI_EVENT_MENU_ITEM |
User picks a row (EmitMenuItemEvent) |
ControlId() (EventControlId if set, else menu .Id()), Index(), Value() (index), Text() (item label), Sender() (event owner if bound) |
MuiMenu does not emit MUI_EVENT_SELECTION_CHANGED directly. Dropdowns emit that event on the dropdown control instead.
Common Setters
| Setter | Purpose |
|---|---|
.Build(items[]) / .BuildEx(labels, enabled, separator) |
Populate rows. |
.Scrollable(on, maxHeight) |
Long menu scrolling. |
.EventBinding(owner, controlId) / .EventOwner + .EventControlId |
Route MUI_EVENT_MENU_ITEM to your control ID. |
.SetHandler(MuiMenuItemHandler*) |
Legacy handler (not owned by menu). |
.UseContextMenuStyle() |
Compact context-menu metrics. |
Notes
- Opening a menu sets overlay
Modal(true)until dismiss. - Esc closes the menu (
OnKeyDown).
Related
MuiContextMenu
Purpose
Static helper to show a context menu at logical chart coordinates. Wraps overlay backdrop + MuiMenu.
Source: Controls/Navigation/Menu.mqh (MuiContextMenu class).
Create It
Mui::ContextMenuAt(root,x,y,items,NULL,200.0,260.0,true);
Lower-level API:
MuiContextMenu::Show(root,x,y,items,handler,width,scrollable,maxHeight,compactStyle,controlId,owner);
Pass controlId and optional owner so MUI_EVENT_MENU_ITEM uses your app ID instead of the ephemeral menu’s ID.
Events
| Event | When it fires | Useful fields |
|---|---|---|
MUI_EVENT_MENU_ITEM |
Item picked | ControlId() (your controlId argument), Index(), Text(), Sender() (owner if provided) |
Example
enum APP_MENU { APP_MENU_CHART=4000 };
void OnChartContext(const double x,const double y)
{
MuiContextMenu::Show(g_ui,x,y,m_items,NULL,220.0,true,240.0,true,APP_MENU_CHART,NULL);
}
void OnMuiEvent(MuiRoot &root,const MuiEventData &event)
{
if(event.EventId()==MUI_EVENT_MENU_ITEM && event.ControlId()==APP_MENU_CHART)
{
if(event.Index()==0) ZoomIn();
}
}
Related
MuiDropdown
Purpose
Ghost button that shows the current selection and opens a MuiMenu overlay to pick an item. Extends MuiButtonAction.
Source: Controls/Navigation/Menu.mqh.
Create It
string presets[];
ArrayResize(presets,3);
presets[0]="Conservative";
presets[1]="Balanced";
presets[2]="Aggressive";
MuiDropdown *dd=Mui::Dropdown(parent,"Preset",presets,NULL,220.0,0.0);
dd.Id(APP_INPUT_PRESET);
Mui::Dropdown(parent, text, items[], handler, width, height).
Events
| Event | When it fires | Useful fields |
|---|---|---|
MUI_EVENT_SELECTION_CHANGED |
User picks a different item (SetSelected(..., userInteraction=true)) |
ControlId(), Index(), OldIndex(), Value() (index), Text() (selected label) |
Programmatic .Selected(idx) does not emit the bus event.
Common Setters
| Setter | Purpose |
|---|---|
.Items(items[]) |
Option list. |
.Text(...) |
Current button label / selection text. |
.Selected(index) |
Programmatic index (no event). |
.MenuScrollable(...), .MenuMaxHeight(...) |
Menu overlay behaviour. |
.SetMenuHandler(...) |
Legacy owned menu handler. |
.Id(...), .SetFixedSize(...) |
Routing and layout. |
Notes
- Clicking the button opens the menu (
OpenMenu). - Inherits button APIs from
MuiButtonAction(also emitsMUI_EVENT_CLICKif you assign a click ID — usually you rely onSELECTION_CHANGEDonly).
Example
if(event.EventId()==MUI_EVENT_SELECTION_CHANGED && event.ControlId()==APP_INPUT_PRESET)
{
ApplyPreset(event.Index(),event.Text());
}