Skip to content
ModernUI A DaneTrades developer library

Inputs

Input controls collect values from the user: booleans, numbers, text, selections, dates, and colors.

Controls And Helpers

Control/helper Use it for Emits events
MuiCheckbox Labelled boolean checkbox. MUI_EVENT_CHECK_CHANGED
MuiToggle Switch-style boolean input. MUI_EVENT_CHECK_CHANGED
MuiSlider Numeric range input. MUI_EVENT_VALUE_CHANGED
MuiSpinEditHost Numeric edit box with stepper buttons. MUI_EVENT_VALUE_CHANGED
MuiTextBoxHost Native single-line text input. None by default
MuiTextAreaHost Native multi-line text input. None by default
MuiComboBoxHost Native-style combo selection. MUI_EVENT_SELECTION_CHANGED
MuiRadioGroup Mutually exclusive radio options. MUI_EVENT_SELECTION_CHANGED
MuiDatePicker Date selection. MUI_EVENT_DATE_CHANGED
MuiColorPicker Color selection and preview. MUI_EVENT_COLOR_PREVIEW_CHANGED, MUI_EVENT_COLOR_CHANGED
MuiDropdown Button-style dropdown selection. MUI_EVENT_SELECTION_CHANGED

Event Fields

Event Useful fields
MUI_EVENT_CHECK_CHANGED Checked(), Value(), Text()
MUI_EVENT_VALUE_CHANGED Value(), Text()
MUI_EVENT_SELECTION_CHANGED Index(), OldIndex(), Text(), Value()
MUI_EVENT_DATE_CHANGED Date(), Value(), Text()
MUI_EVENT_COLOR_PREVIEW_CHANGED Argb(), Value()
MUI_EVENT_COLOR_CHANGED Argb(), Value()

App-level events require .Id(...) ≥ 0 and a connected MuiEventSink. See Event Bus.


MuiCheckbox

Purpose

Labelled boolean checkbox with optional indeterminate visual state. Use for explicit on/off options with readable text beside the box.

Source: Controls/Inputs/Checkbox.mqh.

Create It

UI build fragment
MuiCheckbox *confirm=Mui::Checkbox(parent,"Confirm before trade",NULL);
confirm.Id(APP_INPUT_CONFIRM);
confirm.Checked(true);

MuiCreate::Checkbox(parent, x, y, w, h, label, checked) for explicit bounds.

Form row: Mui::LabeledCheckbox(parent, label, initial, hint).

Events

Event When it fires Useful fields
MUI_EVENT_CHECK_CHANGED User toggles via click or keyboard ControlId(), Checked(), Value() (1.0 on, 0.0 off), Text() (label)

Pointer/keyboard toggle switches only between on and off. Use CheckState(MUI_CHECK_INDETERMINATE) for a third visual state without changing click behaviour.

Common Setters

Setter Purpose
.Label(...) / .Text(...) Checkbox label (alias).
.Checked(bool) / .CheckState(...) On, off, or indeterminate state.
.Visual(...), .Filled(...), .XMark(...) Box appearance variants.
.SetFixedSize(...), .Id(...), .Enabled(...), .Visible(...) Layout and routing.
.SetHandler(MuiCheckHandler*) Legacy owned handler.

Common Reads

Getter Purpose
.Label(), .Checked(), .CheckState() Current label and state.

Notes

  • Programmatic .Checked() / .CheckState() do not emit MUI_EVENT_CHECK_CHANGED; only user interaction does.
  • Inherits common MuiElement spacing and visibility APIs.

Example

UI build fragment
if(event.EventId()==MUI_EVENT_CHECK_CHANGED && event.ControlId()==APP_INPUT_CONFIRM)
  {
   const bool on=event.Checked();
   // event.Text() is the checkbox label
  }

Related


MuiToggle

Purpose

Compact switch-style boolean control without a separate text label (optional tooltip). Use when a switch metaphor fits better than a checkbox.

Source: Controls/Inputs/Toggle.mqh.

Create It

UI build fragment
MuiToggle *enabled=Mui::Toggle(parent,false,NULL);
enabled.Id(APP_INPUT_ENABLED);

MuiCreate::Toggle(parent, x, y, w, h, checked, text) — non-empty text sets a tooltip on the toggle.

Events

Event When it fires Useful fields
MUI_EVENT_CHECK_CHANGED User click or Enter/Space while focused ControlId(), Checked(), Value() (1.0 / 0.0)

Text() is not set on toggle events.

Common Setters

Setter Purpose
.Checked(...) On/off state.
.Pad(...), .Radius(...), .SizePt(...) Chrome and typography.
.Id(...), .Enabled(...), .Visible(...) Routing and interaction.
.SetHandler(MuiCheckedHandler*) Legacy handler.

Common Reads

Getter Purpose
.Checked() Current switch state.

Notes

  • Programmatic .Checked() does not emit the event bus event.
  • Default size follows theme toggle metrics via PreferredWidth() / PreferredHeight().

Example

UI build fragment
if(event.EventId()==MUI_EVENT_CHECK_CHANGED && event.ControlId()==APP_INPUT_ENABLED)
  {
   g_tradingEnabled=event.Checked();
  }

Related


MuiSlider

Purpose

Numeric range control for continuous or stepped values. Supports horizontal and vertical orientation, optional value legend, and theme or custom track colours.

Source: Controls/Inputs/Slider.mqh.

Create It

UI build fragment
MuiSlider *risk=Mui::HorizontalSlider(parent,0.1,10.0,1.0,NULL,220.0,0.0,0.1,true);
risk.Id(APP_INPUT_RISK);

Also: Mui::Slider, Mui::VerticalSlider, Mui::LabeledSlider, MuiCreate::Slider(parent, x, y, w, h, min, max, value).

Events

Event When it fires Useful fields
MUI_EVENT_VALUE_CHANGED Drag release, pointer move while dragging, arrow keys, or keyboard nudge when value actually changes ControlId(), Value(), Text() (formatted value via FormattedCurrentValue())

Programmatic .Value(...) updates display only; it does not emit MUI_EVENT_VALUE_CHANGED.

Common Setters

Setter Purpose
.Range(min, max) Allowed range (max forced above min).
.Value(v) Current value (snapped to range/step).
.StepSize(step) Step for keyboard and snapping (0 = continuous).
.Horizontal(bool) / .Vertical(bool) Orientation.
.ShowCurrentValueLegend(bool), .SetValueLegendPlacement(...), .SetValueDisplayFormat(...) Legend text placement and format.
.FillColor / .AccentColor, .BgColor, .Colors(...), .KnobShape(...), .ThumbSize(...) Track and thumb styling.
.Size(w, h), .SetFixedSize(...), .Id(...) Layout and routing.
.SetHandler(MuiValueHandler*) Legacy handler.

Common Reads

Getter Purpose
.Value() / .CurrentValue() Numeric value.
.Minimum(), .Maximum(), .StepSize() Range configuration.
.FormattedCurrentValue(), .ValueDisplayFormat() Legend/display strings.
.Horizontal() Orientation.

Notes

  • While dragging, value changes can emit multiple MUI_EVENT_VALUE_CHANGED events.
  • UsePreferredSizeAlongLegendAxes() relaxes fixed axes when a legend needs extra space.

Example

UI build fragment
if(event.EventId()==MUI_EVENT_VALUE_CHANGED && event.ControlId()==APP_INPUT_RISK)
  {
   const double pct=event.Value();
   // event.Text() is the formatted legend string when legend is enabled
  }

Related


MuiSpinEditHost

Purpose

Numeric input combining a native OBJ_EDIT field with canvas-painted stepper buttons. Best for bounded numbers with min, max, step, and decimal places.

Source: Controls/Inputs/SpinEditHost.mqh (extends MuiTextBoxHost).

Create It

UI build fragment
MuiSpinEditHost *lots=Mui::SpinEdit(parent,0.01,100.0,0.10,0.01,2,NULL,220.0,0.0,true);
lots.Id(APP_INPUT_LOTS);

Argument order on Mui::SpinEdit: parent, min, max, initial, step, decimals, handler, width, height, stepperFilled.

MuiCreate::SpinEdit(...) and MuiCreate::SpinEdit(parent, MuiSpinEditConfig) for explicit bounds. Form row: Mui::LabeledSpinEdit.

Events

Event When it fires Useful fields
MUI_EVENT_VALUE_CHANGED Native edit commit (OnNativeTextCommitted) or stepper up/down ControlId(), Value(), Text() (formatted numeric string)

Programmatic .Value(...) clamps and refreshes text but does not fire the handler or event bus (per class documentation).

Common Setters

Setter Purpose
.Range(min, max) Numeric bounds.
.Step(step) Stepper increment (> 0).
.Decimals(d) Display decimal places (0–6).
.Value(v) Programmatic value.
.StepperFilled(bool) Filled vs flat stepper halves (default filled).
.Text(...) Inherited; usually managed via .Value() / SyncText().
.SetFixedSize(...), .Id(...), .ReadOnly(...), colour/border overrides from text host Layout, routing, native chrome.
.SetHandler(MuiSpinValueHandler*) Legacy handler.

Common Reads

Getter Purpose
.Value() Current numeric value.
.Text() Formatted string in the native edit.

Notes

  • Native edit behaviour, modal suppression, and scroll clipping follow Native input hosts.
  • Right side reserves logical space for steppers via NativeRightInsetLogical().

Example

UI build fragment
if(event.EventId()==MUI_EVENT_VALUE_CHANGED && event.ControlId()==APP_INPUT_LOTS)
  {
   const double lots=event.Value();
  }

Related


MuiTextBoxHost

Purpose

Single-line text entry using a chart OBJ_EDIT behind themed canvas chrome. Use for names, symbols, notes, and other one-line strings where native editing behaviour matters.

Source: Controls/Inputs/TextBoxHost.mqh.

Create It

UI build fragment
MuiTextBoxHost *name=Mui::TextBox(parent,"Default",260.0,0.0);

MuiCreate::TextBox(parent, x, y, w, h, text, placeholder) — placeholder is applied as tooltip when non-empty.

Mui::LabeledTextBox for label + field rows.

Events

None by default. Read and write .Text() in your save/load or button handlers. The host does not emit app-level UI events on commit.

Common Setters

Setter Purpose
.Text(...) Model string (synced to native object when mounted).
.SetReadOnly(bool) Disables editing.
.BgColor, .BorderColor, .BorderFocus, .TextColor Chrome overrides (0 = theme).
.Pad(...), .Radius(...), .SetFixedSize(...) Layout and appearance.
.Tooltip(...) Hint text (also used for MuiCreate placeholder).

Common Reads

Getter Purpose
.Text() Current text (pulls from native object when created).
.ReadOnly() Read-only flag.

Notes

  • Call MuiRoot::Shutdown() on deinit so native objects are removed.
  • Inside scroll views or modals, hosts hide or resize the native object to avoid overflow; see Native input hosts.

Example

Reference excerpt
void CMyPanel::OnMuiEvent(MuiRoot &root,const MuiEventData &event)
  {
   if(event.EventId()==MUI_EVENT_CLICK && event.ControlId()==APP_ACTION_SAVE)
     {
      const string name=m_name.Text();
      // persist name
     }
  }

Related


MuiTextAreaHost

Purpose

Multi-line native text host with optional auto-scroll and line-oriented helpers (AppendLine, Line, SetLine, etc.). Use for logs, comments, and longer editable text.

Source: Controls/Inputs/TextAreaHost.mqh (extends MuiTextBoxHost).

Create It

UI build fragment
MuiTextAreaHost *notes=Mui::TextArea(parent,"",420.0,120.0,false);

MuiCreate::TextArea(parent, x, y, w, h, text) for explicit bounds. Mui::LabeledTextArea for form rows.

Events

None by default. Poll or read .Text() / line helpers when the user triggers an action (for example a Save button click).

Common Setters

Setter Purpose
.Text(...), .ClearText(), .AppendText(...), .AppendLine(...) Whole-buffer edits.
.InsertText, .ReplaceRange, .DeleteRange, .SetLine, .InsertLine, .DeleteLine Line/range editing API.
.AutoScroll(bool) Scroll to bottom on append when content exceeds viewport.
.ScrollY(y) Vertical scroll offset.
.SetReadOnly(bool), .SetFixedSize(...), colour/border overrides Behaviour and chrome (inherited).

Common Reads

Getter Purpose
.Text() Full buffer text.
.Lines(), .Line(i) Line count and content.
.AutoScroll(), .ScrollY() Scroll state.

Notes

  • Same native host limitations as MuiTextBoxHost.
  • TextHostChromeGrowPx is 0 so borders stay inside logical bounds (reduces parent clip issues).

Example

UI build fragment
if(event.EventId()==MUI_EVENT_CLICK && event.ControlId()==APP_ACTION_READ_NOTES)
  {
   const string body=m_notes.Text();
  }

Related


MuiComboBoxHost

Purpose

Combo field backed by a native text edit plus a dropdown menu overlay for item selection. Supports filtering typed text against the item list when the menu opens.

Source: Controls/Inputs/ComboBoxHost.mqh.

Create It

UI build fragment
string modes[];
ArrayResize(modes,3);
modes[0]="Manual";
modes[1]="Semi-auto";
modes[2]="Disabled";

MuiComboBoxHost *mode=Mui::ComboBox(parent,modes,0,260.0,0.0);
mode.Id(APP_INPUT_MODE);

Mui::ComboBox(parent, items[], handler, initialText, width, height) and MuiCreate::ComboBox overloads. Mui::LabeledCombo for labelled forms.

Events

Event When it fires Useful fields
MUI_EVENT_SELECTION_CHANGED User picks a menu item and the index changes ControlId(), Index(), OldIndex(), Value() (index as double), Text() (selected item string)

Programmatic .Selected(index) sets text without firing selection handlers or the event bus.

Common Setters

Setter Purpose
.Items(items[]) Replace the option list.
.Text(...) Current field text (typed or selected).
.Selected(index) Set selection by index without events.
.MenuMaxHeight(h) Dropdown menu max height (logical px, minimum ~80).
.SetFixedSize(...), .Id(...), .SetReadOnly(...) Layout and routing.
.SetHandler(MuiComboItemHandler*) Legacy handler.

Common Reads

Getter Purpose
.Selected() Index of item matching current text exactly, or -1.
.Text() Current field text.

Notes

  • Native edit + overlay menu: see Native input hosts.
  • NativeRightInsetLogical() reserves space for the dropdown affordance.
  • MuiDropdown (navigation menu button) is documented on Navigation (Phase 4).

Example

UI build fragment
if(event.EventId()==MUI_EVENT_SELECTION_CHANGED && event.ControlId()==APP_INPUT_MODE)
  {
   const int ix=event.Index();
   const string label=event.Text();
  }

Related


MuiRadioGroup

Purpose

Mutually exclusive options rendered as radio items. Each option is a child MuiRadioItem created via AddOption.

Source: Controls/Inputs/RadioGroup.mqh.

Create It

UI build fragment
MuiRadioGroup *side=Mui::RadioGroup(parent,NULL);
side.AddOption("Buy");
side.AddOption("Sell");
side.Id(APP_INPUT_SIDE);
side.Selected(0);  // programmatic; does not emit events

MuiCreate::RadioGroup(parent, x, y, w, h) or overload with items[], selectedIndex, and optional handler.

Events

Event When it fires Useful fields
MUI_EVENT_SELECTION_CHANGED User selects a different option ControlId(), Index(), OldIndex(), Value() (index), Text() (selected label)

Programmatic .Selected(idx) updates highlight only; use user Select path for events (user clicks call Select internally).

Common Setters

Setter Purpose
.AddOption(label) Append option; returns MuiRadioItem*.
.Selected(index) Programmatic selection (no event).
.MarkStyle(style) Glyph inside radio (fill dot, check, X, filled mark).
.Pad(...), .SizePt(...), .Id(...), .Enabled(...) Layout and routing.
.SetHandler(MuiRadioChangedHandler*) Legacy handler.

Common Reads

Getter Purpose
.Selected() Current selected index.
.MarkStyle() Marker style id.

Notes

  • Child items are owned by the group container.
  • Prefer assigning .Id(...) on the group, not on individual radio items.

Example

UI build fragment
if(event.EventId()==MUI_EVENT_SELECTION_CHANGED && event.ControlId()==APP_INPUT_SIDE)
  {
   const bool isBuy=(event.Index()==0);
   const string label=event.Text();
  }

Related


MuiDatePicker

Purpose

Date field with calendar popup (MuiCalendarPopup) opened from a button-styled field. Enforces optional min/max dates on calendar picks.

Source: Controls/Inputs/DatePicker.mqh.

Create It

UI build fragment
MuiDatePicker *start=Mui::DatePicker(parent,TimeCurrent(),NULL,220.0,0.0,0.0);
start.Id(APP_INPUT_START_DATE);

MuiCreate::DatePicker(parent, x, y, w, h, value). Mui::LabeledDatePicker for form rows.

Events

Event When it fires Useful fields
MUI_EVENT_DATE_CHANGED User commits a new calendar date (ApplyYMD when value changes) ControlId(), Date(), Value() ((double)datetime), Text() (TIME_DATE string)

Programmatic .Value(datetime) updates the field without emitting the event bus event.

Common Setters

Setter Purpose
.Value(datetime) Current date.
.MinDate(t), .MaxDate(t) Allowed range for calendar selection.
.PopupWidth(w), .CalendarFontSize(pt), .CalendarPad(...), .CalendarCellHeight(...), calendar colour setters Popup layout and theme.
.TextColor(argb) Field label/date text colour.
.SetFixedSize(...), .Id(...) Layout and routing.
.SetHandler(MuiDateChangedHandler*) Legacy owned handler.

Common Reads

Getter Purpose
.Value() / .PickedValue() Selected datetime.

Notes

  • Calendar opens in the root overlay layer; backdrop dismiss closes the popup.
  • Field inherits button-like chrome setters (SizePt, Pad, Radius) from the date field implementation.

Example

UI build fragment
if(event.EventId()==MUI_EVENT_DATE_CHANGED && event.ControlId()==APP_INPUT_START_DATE)
  {
   const datetime d=event.Date();
  }

Related


MuiColorPicker

Purpose

Full color editor with swatch preview, HSV square, hue strip, and RGB/HSL/Lab spin groups. Emits preview events while the value changes and a commit event when the user confirms.

Source: Controls/Inputs/ColorPicker.mqh.

Create It

Reference excerpt
MuiColorPicker *accent=Mui::ColorPicker(parent,0xFF3B82F6,NULL);
accent.Id(APP_INPUT_ACCENT);

MuiCreate::ColorPicker(parent, x, y, w, h, color) uses color type for initial value. Mui::LabeledColorPicker for form rows.

Events

Event When it fires Useful fields
MUI_EVENT_COLOR_PREVIEW_CHANGED Live edits (HSV, spins, groups) via NotifyChanged ControlId(), Argb(), Value() ((double)argb)
MUI_EVENT_COLOR_CHANGED User commits (OK) when committed color differs from baseline ControlId(), Argb(), Value()

Revert restores baseline without emitting MUI_EVENT_COLOR_CHANGED.

Common Setters

Setter Purpose
.Value(argb) Live color (also updates baseline on programmatic set).
.Commit(root) / .Revert(root) Apply or discard edits relative to baseline.
.SetFixedSize(...) — picker self-layouts; set both dimensions when overriding size Layout.
.Id(...), .SetHandler(MuiColorPickHandler*) Routing and legacy callback.

Common Reads

Getter Purpose
.Value() / .SelectedArgb() Current ARGB (alpha forced opaque).
.BaselineArgb() Last committed color.
.SelectedRgb(r,g,b) Unpacked RGB.

Notes

  • Preview events can be frequent while dragging; throttle heavy work in OnMuiEvent if needed.
  • Internal spin edits and swatches are sub-controls; route using the picker’s .Id(...).

Example

UI build fragment
if(event.EventId()==MUI_EVENT_COLOR_PREVIEW_CHANGED && event.ControlId()==APP_INPUT_ACCENT)
  {
   const uint preview=(uint)event.Argb();
  }
else if(event.EventId()==MUI_EVENT_COLOR_CHANGED && event.ControlId()==APP_INPUT_ACCENT)
  {
   const uint committed=(uint)event.Argb();
  }

Related


Related Pages