Skip to content

GUI

Example: Display a simple dialog with a label

The dialog as shown on the calculator, with "Dialog Title" as title and "Label Text" as body

Here we are using a GUIDialog that’s wrapping a GUILabel. The code should look like this :

GUIDialog dialog(
    GUIDialog::Height25,
    GUIDialog::AlignTop,
    "Dialog Title",
    GUIDialog::KeyboardStateABC
);

GUILabel label(
    dialog.GetLeftX() + 10,
    dialog.GetTopY() + 10,
    "Label Text"
);
dialog.AddElement(label);

dialog.ShowDialog();

Where the Height25 means 1/4 of the screen height, and AlignTop that it’ll be top-aligned, fixed to screen top. The KeyboardStateABC is a flag indicating what the keyboard should display if called on this dialog. Here the “ABC” tells it’ll be the standard “abc” keyboard when pressing the “Keyboard” key.