Skip to content
ModernUI A DaneTrades developer library

Fast Wrappers Overview

Fast wrappers are optional creation helpers that build common ModernUI structures in fewer lines.

They are exposed as Mui::... helpers and live on top of the normal ModernUI control tree.

Use them when you want a clean panel quickly. Use raw controls when the layout, data source, lifetime, or event handling needs full control.

Two development paths

Path Use it when
Fast wrappers You want a standard panel shape quickly: app window, sections, labelled inputs, button rows, status rows, simple tables
Raw controls You need custom layout, custom data sources, advanced event wiring, or behaviour the wrappers do not model

Most real projects use both.

A common pattern is:

Pseudo-code
AppWindow + Section + labelled rows from wrappers
Custom table, chart, drawer, or handler logic from raw controls

Basic wrapper shape

Wrappers create controls and return useful handles.

UI build fragment
MuiAppWindow app=Mui::AppWindow(g_ui,"Panel",20,40,340,430,true);

MuiSection settings=Mui::Section(app.content,"Settings","Quick controls");

MuiLabeledSpinEdit risk=Mui::LabeledSpinEdit(
  settings.body,
  "Risk %",
  0.1,
  10.0,
  0.1,
  1.0
);

After creation, you still have access to the created pieces:

UI build fragment
if(risk.control!=NULL)
{
  risk.control.Value(2.0);
  risk.control.AccentColor(0xFF3B82F6);
}

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

Return objects

Composite wrappers return small structs.

Common examples:

Wrapper Return type Important fields
Mui::AppWindow MuiAppWindow window, content
Mui::Section MuiSection panel, title, subtitle, body
Mui::LabeledSpinEdit MuiLabeledSpinEdit root, label, control, hint
Mui::ButtonRow MuiButtonRow root, Count(), Button(index)
Mui::ButtonGroup MuiButtonGroup root, Selected(), Selected(index), Button(index)
Mui::SimpleTable MuiSimpleTable table, source, SetCell, SetRow, Refresh

The field name is control, not input. In MQL5, input is a reserved keyword for EA inputs.

Ownership model

Wrappers follow the normal ModernUI ownership model:

  • controls added to a container are owned by that container
  • g_ui.Shutdown() tears down the UI tree for a normal EA
  • some helpers allocate extra model/source objects and expose them for advanced cleanup
  • returned pointers are handles, not separate ownership instructions

Where a wrapper has a special ownership rule, the specific wrapper page explains it.

Wrappers are additive

Fast wrappers do not deprecate older patterns.

These remain valid:

UI build fragment
MuiButtonAction *b=Mui::Button(parent,"Save",NULL,100.0,34.0);
MuiSpinEditHost *s=Mui::SpinEdit(parent,0.1,10.0,1.0,0.1,2,NULL,220.0,0.0);
MuiTableView *table=new MuiTableView();

Use wrappers when they save time. Use raw controls when they make the code clearer.

Before and after

Manual build:

UI build fragment
MuiContainer *col=Mui::Column(parent,6.0);
MuiLabel *cap=Mui::CaptionLabel(col,"Risk %",0.0,0.0);
MuiSpinEditHost *sp=Mui::SpinEdit(col,0.1,10.0,1.0,0.1,2,NULL,220.0,0.0);
MuiLabel *hint=Mui::CaptionLabel(col,"Percent of equity",0.0,0.0);

Fast wrapper:

UI build fragment
MuiLabeledSpinEdit risk=Mui::LabeledSpinEdit(
  parent,
  "Risk %",
  0.1,
  10.0,
  0.1,
  1.0,
  2,
  0.0,
  0.0,
  "Percent of equity"
);

The wrapper does not make MuiSpinEditHost less capable. It only removes repeated setup code.

Good use cases

Fast wrappers work well for:

  • trade manager panels
  • risk/settings panels
  • account selection panels
  • copier configuration panels
  • dashboards with simple controls
  • support/debug tools
  • admin utilities

When to avoid wrappers

Use raw controls when:

  • you need a custom table/list/tree source
  • you need lazy-created tab bodies
  • you need specialised ownership
  • the wrapper hides a detail you must configure manually
  • your layout is not a standard vertical panel/card pattern

Related pages