Skip to content
ModernUI A DaneTrades developer library

Labeled Inputs

Labeled input wrappers create a caption, an input control, and an optional hint line in one call.

They are useful for settings panels, risk panels, copier configuration, account selectors, and compact tool panels.

When to use this

Use labeled inputs when you want a consistent form layout:

Pseudo-code
Label
Control
Optional hint

Each wrapper returns a struct with:

  • root
  • label
  • control
  • hint

The important field is usually control. That is the actual input widget.

Essential labelled inputs

Helper Underlying control Common use
Mui::LabeledTextBox MuiTextBoxHost names, IDs, comments, short text
Mui::LabeledSpinEdit MuiSpinEditHost risk, lots, numeric settings
Mui::LabeledCombo MuiComboBoxHost modes, presets, accounts, symbols
Mui::LabeledCheckbox MuiCheckbox true/false settings
Mui::LabeledSlider MuiSlider ratios, percentages, quick adjustment

Secondary labelled inputs

Helper Underlying control Common use
Mui::LabeledTextArea MuiTextAreaHost notes and multi-line text
Mui::LabeledDatePicker MuiDatePicker dates and schedules
Mui::LabeledColorPicker MuiColorPicker colour selection and theme settings

Basic settings example

Place inside OnInit after g_ui.Init succeeds
MuiAppWindow app=Mui::AppWindow(g_ui,"Settings",20,40,360,460,true);
MuiSection main=Mui::Section(app.content,"Inputs","Common labelled controls");

MuiLabeledSpinEdit risk=Mui::LabeledSpinEdit(
  main.body,
  "Risk %",
  0.1,
  10.0,
  0.1,
  1.0,
  1,
  0.0,
  0.0,
  "Percent value only. Your EA decides how to use it."
);

MuiLabeledSpinEdit lots=Mui::LabeledSpinEdit(
  main.body,
  "Lots",
  0.01,
  100.0,
  0.01,
  0.10,
  2
);

MuiLabeledCheckbox confirm=Mui::LabeledCheckbox(
  main.body,
  "Confirm before action",
  true,
  "Useful for destructive or broker-facing actions."
);

Combo example

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

MuiLabeledCombo mode=Mui::LabeledCombo(
  section.body,
  "Mode",
  modes,
  0,
  0.0,
  0.0,
  "Select the operating mode."
);

When items[] is not empty, selected is clamped to the valid range.

Slider example

UI build fragment
MuiLabeledSlider reward=Mui::LabeledSlider(
  section.body,
  "Reward (x)",
  0.5,
  5.0,
  0.5,
  2.0,
  0.0,
  0.0,
  "Illustrative reward multiple."
);

if(reward.control!=NULL)
  reward.control.AccentColor(0xFF3B82F6);

The labelled slider is compact by default. It does not show the value legend unless you enable that with the lower-level slider API.

Text area, date, and colour example

UI build fragment
MuiLabeledTextArea notes=Mui::LabeledTextArea(
  section.body,
  "Notes",
  "",
  0.0,
  0.0,
  "Optional multi-line text."
);

MuiLabeledDatePicker due=Mui::LabeledDatePicker(
  section.body,
  "Due",
  TimeCurrent(),
  0.0,
  0.0,
  ""
);

MuiLabeledColorPicker colour=Mui::LabeledColorPicker(
  section.body,
  "Accent",
  0xFF3B82F6,
  0.0,
  0.0,
  ""
);

For LabeledColorPicker, pass both width and height if you want to force a fixed size. If only one dimension is set, the wrapper does not partially resize the colour picker.

Customising after creation

The wrapper gives you handles to the label, control, and hint.

UI build fragment
if(risk.control!=NULL)
  risk.control.Value(2.0);

if(risk.label!=NULL)
  risk.label.Text("Risk per trade");

if(risk.hint!=NULL)
  risk.hint.Text("Used by your EA logic, not by ModernUI itself.");

Width and height defaults

Most labelled wrappers accept width and height.

Use 0.0 to use the library defaults.

Common patterns:

Argument Behaviour
width == 0.0 Uses the wrapper/control default width
height == 0.0 Uses the theme input height where applicable
positive width/height Uses the explicit size when the underlying control supports it

The control field

The returned struct uses control, not input.

UI build fragment
MuiLabeledSpinEdit risk=Mui::LabeledSpinEdit(section.body,"Risk %",0.1,10.0,0.1,1.0);

if(risk.control!=NULL)
  risk.control.Value(1.5);

Do not expect a field named input. In MQL5, input is reserved for EA input variables.

Common mistakes

Expecting ModernUI to apply trading logic

ModernUI only creates UI controls. Your EA decides what a value means.

A risk field is just a UI value until your code reads it and applies trading logic.

Forgetting null checks in reusable code

Factory helpers return safe empty structs when parent == NULL.

If you are writing reusable builders, check control != NULL before updating.

Styling only through creation parameters

Creation wrappers keep structural arguments in the function signature. Use setters for styling:

UI build fragment
risk.control.AccentColor(0xFF3B82F6);
risk.control.BorderColor(0xFF334155);
risk.label.SizePt(11);

Related pages