Skip to content

UXAlert

UXAlert is the only modal thing in the toolkit, and it contains no dialog code. It is the model (icon, message lines, buttons, the default), and runModal hands it to the driver. The driver shows the platform’s own dialog (GEM’s form_alert, Win32’s MessageBox, AppKit’s NSAlert, the web’s ring round-trip) and returns the 1-based button. The shape comes from GEM, where an alert is the string "[icon][line|line][button|button]". This class describes that string in neutral form.

#use <UXKit>
UXAlert* a = new UXAlert();
a.icon = (i32)3; // 0 none / 1 note / 2 wait / 3 stop
a.addLine((u8*)"Close without saving?");
a.addButton((u8*)"Save");
a.addButton((u8*)"Discard");
a.addButton((u8*)"Cancel");
a.defaultButton = (i32)1; // Return fires it
i32 pick = a.runModal(); // 1-based; blocks, modally
void addLine(u8* s)

Appends a message line.

void addButton(u8* s)

Appends a button, left to right. runModal returns the 1-based index of the pressed button.

i32 runModal(void)

Blocks modally until the user picks, and returns the 1-based button. The driver draws, tracks and dismisses the dialog, so alerts behave the same from GEM to the web worker.

  • icon: 0 none, 1 note, 2 wait, 3 stop. The theme carries art for all three.
  • defaultButton: 1-based. Return fires it. Escape fires the cancel button where the platform has that convention.

Every platform shows the same model: icon 3 (stop), two lines, Save|Cancel, default 1, rendered by the driver’s native dialog.

alertRun blocks correctly (the SAB ring’s type-7 reply, covered by the web-alert gate), but this driver does not draw the dialog yet. The answer comes from the page, not from a panel.