Add an custom Dialog Prompt to your Real-time Application in TurtleBrains.
The following guide is a continuation of HowTo: Start a Real-time Application which provides a great way to start an application if you haven't already.
The following steps are the same basic steps taken to add a Status Bar, Menu, or Dialog Prompt to your application.
- Create the necessary identifiers for the dialog and dialog controls. (ex. DialogIdentifier / DialogControlIdentifier)
- Create and customized the dialog prompt as desired, setting up everything as needed. (ex. ApplicationDialog / AddDialogControl)
- Handle events in the ApplicationHandler when the user interacts with the dialog prompt. (ex. OnDialogAction).
Creating a dialog prompt, is not so different from creating a Menu, first create the identifiers, then customize the dialog and finally handle the events from user interaction.
MyApplicationValues.h (modify to add dialog values)
enum MyDialogs { kDialogCreate, }
enum MyDialogControls { kControlStatic, kControlOkayButton, }
MyApplicationHandler.cpp (modify to add dialog prompt)
void MyApplicationHandler::OnWindowOpen(void)
{
}
MyApplicationHandler.cpp (modify to add dialog prompt)
void MyApplicationHandler::OnDialogAction(const DialogIdentifier& dialog, const DialogControlIdentifier& dialogControl)
{
if (kDialogCreate == dialog)
{
tbApplicationDialog createPrompt(kDialogCreate);
if (kControlOkayButton == dialogControl)
{
}
}
}