Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/The-Young-Maker/OpenMenuOS/llms.txt

Use this file to discover all available pages before exploring further.

PopupManager is a fully static class that drives the popup system in OpenMenuOS. Because every method is static you never instantiate it — you call PopupManager::showInfo(...) directly. Popups are non-blocking: a show* call renders the overlay immediately, and your loop() must call PopupManager::update() on every iteration to process user input and return the final result.

Static methods

show()

Display a popup built from a PopupConfig struct. Use this when the convenience wrappers below do not cover your needs — for example when you want auto-close on a warning, a custom color, or a custom icon.
static PopupResult show(const PopupConfig& config);
PopupConfig config;
config.message = "Custom popup with auto-close feature enabled.";
config.title = "Custom Title";
config.type = PopupType::INFO;
config.autoClose = true;
config.autoCloseDelay = 5000; // 5 seconds
config.customColor = 0x7E0;   // Custom green color
PopupManager::show(config);

showInfo()

Show a blue informational popup. The default title is "Information" when title is nullptr.
static PopupResult showInfo(const char* message, const char* title = nullptr);

showSuccess()

Show a green success popup. Auto-closes after approximately 3 seconds by default. The default title is "Success".
static PopupResult showSuccess(const char* message, const char* title = nullptr);

showWarning()

Show an orange warning popup. Requires manual dismissal. The default title is "Warning".
static PopupResult showWarning(const char* message, const char* title = nullptr);

showError()

Show a red error popup. Requires manual dismissal. The default title is "Error".
static PopupResult showError(const char* message, const char* title = nullptr);

showQuestion()

Show a cyan question popup with Yes/No buttons. Returns PopupResult::OK when the user confirms and PopupResult::CANCEL when they decline. The default title is "Question".
static PopupResult showQuestion(const char* message, const char* title = nullptr);

update()

Process input and refresh the active popup. Must be called on every loop() iteration. Returns PopupResult::NONE while the popup is still open, and PopupResult::OK or PopupResult::CANCEL the moment the user dismisses it (or when auto-close fires).
static PopupResult update();

hide()

Programmatically dismiss the currently active popup without waiting for user input.
static void hide();

isActive()

Returns true when a popup is currently visible on screen.
static bool isActive();

Non-blocking pattern

All show* methods render the popup overlay immediately and return PopupResult::NONE. The actual result (OK, CANCEL) only becomes available through PopupManager::update() in your main loop. This means your sketch continues to run — you must poll update() to learn when the user acted. The recommended loop structure:
void loop() {
  PopupResult popupResult = PopupManager::update();
  menu.loop();

  if (popupResult != PopupResult::NONE) {
    switch (popupResult) {
      case PopupResult::OK:
        // user pressed OK or Yes
        break;
      case PopupResult::CANCEL:
        // user pressed Cancel or No
        break;
      default:
        break;
    }
  }
}
menu.loop() is intentionally called even while a popup is visible. PopupManager blocks input from reaching the underlying menu automatically. If you prefer to skip menu processing while a popup is active, guard it with if (!PopupManager::isActive()) { menu.loop(); }.

Convenience method examples

PopupManager::showInfo("This is an information message!", "Info Demo");
Renders a blue popup. Stays open until the user presses OK.

PopupConfig struct

PopupConfig gives you full control over every aspect of a popup. Pass a configured instance to PopupManager::show().
PopupConfig config;
config.message        = "Settings saved successfully.";
config.title          = "Saved";
config.type           = PopupType::SUCCESS;
config.autoClose      = true;
config.autoCloseDelay = 4000;
PopupManager::show(config);
message
const char*
required
Main body text displayed in the popup. Supports automatic word wrapping for long strings. This field must not be nullptr.
title
const char*
Title text shown in the popup header. When nullptr, a type-specific default is used: "Information", "Success", "Warning", "Error", or "Question".
type
PopupType
default:"PopupType::INFO"
Controls the color scheme and default icon. One of PopupType::INFO, PopupType::SUCCESS, PopupType::WARNING, PopupType::ERROR, or PopupType::QUESTION. See Popup types and visual styles for details on each value.
showButtons
bool
default:"true"
When true, action buttons (OK, or Yes/No for QUESTION) are rendered at the bottom of the popup.
showCancelButton
bool
default:"false"
When true, a Cancel/No button is shown alongside the OK button. This is set automatically for PopupType::QUESTION; you can also set it on other types to create a confirmation dialog.
autoClose
bool
default:"false"
When true, the popup dismisses itself after autoCloseDelay milliseconds. PopupType::SUCCESS uses auto-close by default via showSuccess().
autoCloseDelay
uint32_t
default:"3000"
Milliseconds to wait before auto-closing. Only relevant when autoClose is true.
customColor
uint16_t
default:"0"
RGB565 color value for the popup header. When 0, the color defined by the type is used.
customIcon
const uint16_t*
Pointer to raw RGB565 image data to use as the popup icon instead of the built-in type icon. Set to nullptr to use the default icon for the chosen type.
customIconWidth
uint16_t
default:"0"
Width in pixels of the customIcon image.
customIconHeight
uint16_t
default:"0"
Height in pixels of the customIcon image.

Question dialog pattern

The showQuestion() convenience method (and any PopupConfig with showCancelButton = true) gives the user a Yes/No choice. Because PopupManager is non-blocking, the decision arrives through update() on a later loop iteration — not as an immediate return value from the show* call.
// Trigger the question from a menu action callback
void resetDevice() {
  PopupManager::showQuestion(
    "This will restart the device.\nContinue?",
    "Reset Device"
  );
}

// Handle the answer in loop()
void loop() {
  PopupResult result = PopupManager::update();
  menu.loop();

  if (result == PopupResult::OK) {
    // User pressed Yes — restart
    delay(500);
    ESP.restart();
  } else if (result == PopupResult::CANCEL) {
    // User pressed No — do nothing
  }
}
With a rotary encoder, rotate to move the highlight between the Yes and No buttons, then press the encoder button to confirm the selection.

Build docs developers (and LLMs) love