Terminality provides three ready-to-use dialog types that handle their own rendering and event loops so your application code stays simple.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Rikitav/Terminality/llms.txt
Use this file to discover all available pages before exploring further.
MessageBox blocks until the user dismisses it and returns a typed result. ContextMenu attaches to any control and opens at an arbitrary screen position. OpenFileDialog presents a file-picker and returns an optional<filesystem::path> you can test before using.
MessageBox
MessageBox::Show is a static method that renders a blocking modal dialog and returns which button the user pressed.
Signature
Button sets
MessageBoxButton::Ok
Displays a single Ok button. The default when no argument is passed.
MessageBoxButton::OkCancel
Displays Ok and Cancel.
MessageBoxButton::YesNo
Displays Yes and No.
MessageBoxButton::YesNoCancel
Displays Yes, No, and Cancel.
Return values
MessageBoxResult | Meaning |
|---|---|
None | Dialog was closed without a selection. |
Ok | User pressed Ok. |
Cancel | User pressed Cancel. |
Yes | User pressed Yes. |
No | User pressed No. |
Example from TespApp
The messenger demo callsMessageBox::Show both from a button’s Clicked event and from a hotkey that opens a help overlay:
ContextMenu
AContextMenu is a popup list of labelled actions. You create one, populate it with AddItem, assign it to a control’s CtxMenu property, and call OpenContextMenu() or Open(position) to show it.
ContextMenuItem
Each entry in the menu is a plain struct:ContextMenu class
| Method | Description |
|---|---|
AddItem(text, action) | Appends a new item with the given label and callback. |
Clear() | Removes all items. |
Open(position) | Opens the menu at the given screen Point. |
Attaching a menu to a control
ControlBase exposes a typed CtxMenu property and a convenience method:
unique_ptr<ContextMenu> to CtxMenu, then call OpenContextMenu() from a hotkey or event handler.
Example from TespApp
TheMessageBubble item template attaches a context menu and binds the D key to open it:
AlertAsync is a Windows-only helper declared in the terminality:Windows module. Guard any call to it with #ifdef _WIN32.OpenFileDialog
OpenFileDialog::Show presents a file-picker dialog and returns an optional<filesystem::path>. The optional is empty if the user cancels.
Signature
Checking the result
Always testhas_value() before accessing the path:
Example from TespApp
The minus key on the numpad opens a file picker and shows the result (or a “returned nothing” message) in aMessageBox: