Toast, StatusRow, and DrawerSection
These helpers cover common feedback and compact layout patterns:
Mui::Toastshows short feedback.Mui::ToastSuccess,Mui::ToastWarning, andMui::ToastErroradd semantic tone.Mui::StatusRowcreates a label plus badge row.Mui::DrawerSectioncreates a tighter section for drawer-style columns.
Use them to make EA panels feel responsive without writing repeated layout code.
Toast helpers
Toast helpers route through the ModernUI toast service.
Mui::Toast(g_ui,"Settings saved");
Mui::ToastSuccess(g_ui,"Connected");
Mui::ToastWarning(g_ui,"Check the input values.");
Mui::ToastError(g_ui,"Action failed.");
Plain Toast is neutral. The semantic helpers use success, warning, or danger styling.
Toast signature
void Mui::Toast(
MuiRoot &root,
string message,
ulong durationMs=2200,
int corner=MUI_TOAST_BOTTOM_RIGHT,
double marginLogical=-1.0
);
Semantic shortcuts:
void Mui::ToastSuccess(MuiRoot &root,string message,int ms=2500);
void Mui::ToastWarning(MuiRoot &root,string message,int ms=2500);
void Mui::ToastError(MuiRoot &root,string message,int ms=2500);
Use toasts for short, non-blocking feedback. Do not use them for long explanations or critical confirmations.
StatusRow
StatusRow creates a horizontal row with a label on the left and a badge on the right.
MuiStatusRow Mui::StatusRow(
MuiContainer *parent,
string label,
string value,
string variant="neutral"
);
Example:
MuiStatusRow status=Mui::StatusRow(section.body,"Status","Ready","neutral");
MuiStatusRow connection=Mui::StatusRow(section.body,"Connection","Demo","info");
Update after creation:
if(status.badge!=NULL)
{
status.badge.Text("Running");
status.badge.Variant(MUI_BADGE_SUCCESS);
}
Status variants
Variant strings are case-insensitive.
| String | Badge variant |
|---|---|
neutral |
neutral |
primary |
primary |
success |
success |
warning |
warning |
danger |
danger |
error |
danger |
info |
info |
Unknown strings fall back to neutral.
DrawerSection
DrawerSection creates a tighter section layout for drawer-style panels.
MuiSection Mui::DrawerSection(
MuiContainer *drawerBody,
string title,
string subtitle=""
);
It does not create or open a drawer. Pass an existing drawer/container body.
MuiDrawer *drawer=Mui::Drawer(280,true);
MuiSection prefs=Mui::DrawerSection(
(MuiContainer*)drawer,
"Preferences",
"Defaults"
);
Mui::LabeledCheckbox(prefs.body,"Confirm before close",true);
drawer.Open(g_ui);
Combined example
MuiAppWindow app=Mui::AppWindow(g_ui,"Feedback",20,40,360,420,true);
MuiSection state=Mui::Section(app.content,"State","Inline labels and badges");
MuiStatusRow job=Mui::StatusRow(state.body,"Job","Ready","neutral");
MuiStatusRow account=Mui::StatusRow(state.body,"Account","Demo","info");
Mui::Toast(g_ui,"Panel ready");
Mui::ToastSuccess(g_ui,"ModernUI loaded");
Common mistakes
Using toasts for important confirmations
Toasts are temporary. Use a dialog or confirmation UI for actions that need explicit user approval.
Expecting DrawerSection to open a drawer
DrawerSection only creates a section inside a drawer/container. It does not create the drawer and does not open it.
Updating a status row without null checks
If you build reusable sections, check the returned pointers:
if(job.badge!=NULL)
job.badge.Text("Stopped");