dialog.h

Functions and structures to manipulate dialog windows.

This file defines the dialog service, which provides an API to create, configure, display, update, and cancel dialog windows.

Dialog Usage

Dialog Usage

In general, to display a dialog, the following steps will be taken:

  • Create a specific type of dialog using the appropriate dialog creation function.
  • Customize the dialog by setting its attributes.
  • Display the dialog.
  • Clean up dialog resources.

For example, to create, customize, and display an alert dialog:

   dialog_instance_t dialog = 0;
   dialog_create_alert(&dialog);
   dialog_set_alert_message_text(dialog, "Here's a message...");

   dialog_set_background_alpha(dialog, 0.0);
   dialog_set_cover_sensitivity(dialog, DIALOG_COVER_SENSITIVITY_ALPHA_TEST);
   dialog_set_group_id(dialog, "yourWindowId");

   dialog_add_button(dialog, "CANCEL", true, NULL, true);
   dialog_add_button(dialog, "OK", true, NULL, true);
   dialog_show(dialog);
 

To decode the response from a dialog:

   dialog_instance_t dialog = dialog_event_get_dialog_instance(event);
   int selected_index = dialog_event_get_selected_index(event);
   const char* label = dialog_event_get_selected_label(event);
 

To clean up dialog resources:

   dialog_destroy(dialog);