Status & Roadmap
Authors & License
Funding Ultimate++
Search on this site

SourceForge.net Logo

Message Boxes

Message boxes in U++ provide up to 3 buttons. The message is using QTF rich text format - it means that you can for example embed hyper-link or even table or image. This however can cause issues if some non-literal text is presented which can accidentally contain QTF formatting characters. To solve this, you can use DeQtf function '\1' switch (supresses QTF parsing till the next '\1'), e.g.:

PromptOK(DeQtf("C:\\Program Files\\Upp\\theide"));

PromptOK("\1C:\\Program Files\\Upp\\theide");


void PromptOK(const char *qtf)

qtf .







int PromptOKCancel(const char *qtf)

int PromptOKCancelAll(const char *qtf)

int PromptYesNo(const char *qtf)

int PromptYesNoCancel(const char *qtf)

int PromptYesNoAll(const char *qtf)

int PromptRetryCancel(const char *qtf)

int PromptAbortRetry(const char *qtf)

int PromptAbortRetryIgnore(const char *qtf)

int PromptSaveDontSaveCancel(const char *qtf)

void ShowExc(const Exc& exc)

void Exclamation(const char *qtf)

void ErrorOK(const char *qtf)

int ErrorOKCancel(const char *qtf)

int ErrorYesNo(const char *qtf)

int ErrorYesNoCancel(const char *qtf)

int ErrorYesNoAll(const char *qtf)

int ErrorRetryCancel(const char *qtf)

int ErrorAbortRetry(const char *qtf)

int ErrorAbortRetryIgnore(const char *qtf)

void PromptOKOpt(const char *qtf, const char *opt_id = NULL)

int PromptOKCancelOpt(const char *qtf, const char *opt_id = NULL)

int PromptOKCancelAllOpt(const char *qtf, const char *opt_id = NULL)

int PromptYesNoOpt(const char *qtf, const char *opt_id = NULL)

int PromptYesNoCancelOpt(const char *qtf, const char *opt_id = NULL)

int PromptYesNoAllOpt(const char *qtf, const char *opt_id = NULL)

int PromptRetryCancelOpt(const char *qtf, const char *opt_id = NULL)

int PromptAbortRetryOpt(const char *qtf, const char *opt_id = NULL)

int PromptAbortRetryIgnoreOpt(const char *qtf, const char *opt_id = NULL)

int PromptSaveDontSaveCancelOpt(const char *qtf, const char *opt_id = NULL)

void ExclamationOpt(const char *qtf, const char *opt_id = NULL)

void ErrorOKOpt(const char *qtf, const char *opt_id = NULL)

int ErrorOKCancelOpt(const char *qtf, const char *opt_id = NULL)

int ErrorYesNoOpt(const char *qtf, const char *opt_id = NULL)

int ErrorYesNoCancelOpt(const char *qtf, const char *opt_id = NULL)

int ErrorYesNoAllOpt(const char *qtf, const char *opt_id = NULL)

int ErrorRetryCancelOpt(const char *qtf, const char *opt_id = NULL)

int ErrorAbortRetryOpt(const char *qtf, const char *opt_id)

int ErrorAbortRetryIgnoreOpt(const char *qtf, const char *opt_id)

void ShowExcOpt(const Exc& exc, const char *opt_id)

void PromptOKOpt1(const char *qtf, const char *opt_id)

int PromptOKCancelOpt1(const char *qtf, const char *opt_id)

int PromptOKCancelAllOpt1(const char *qtf, const char *opt_id)

int PromptYesNoOpt1(const char *qtf, const char *opt_id)

int PromptYesNoCancelOpt1(const char *qtf, const char *opt_id)

int PromptYesNoAllOpt1(const char *qtf, const char *opt_id)

int PromptRetryCancelOpt1(const char *qtf, const char *opt_id)

int PromptAbortRetryOpt1(const char *qtf, const char *opt_id)

int PromptAbortRetryIgnoreOpt1(const char *qtf, const char *opt_id)

int PromptSaveDontSaveCancelOpt1(const char *qtf, const char *opt_id)

void ExclamationOpt1(const char *qtf, const char *opt_id)

void ErrorOKOpt1(const char *qtf, const char *opt_id)

int ErrorOKCancelOpt1(const char *qtf, const char *opt_id)

int ErrorYesNoOpt1(const char *qtf, const char *opt_id)

int ErrorYesNoCancelOpt1(const char *qtf, const char *opt_id)

int ErrorYesNoAllOpt1(const char *qtf, const char *opt_id)

int ErrorRetryCancelOpt1(const char *qtf, const char *opt_id)

int ErrorAbortRetryOpt1(const char *qtf, const char *opt_id)

int ErrorAbortRetryIgnoreOpt1(const char *qtf, const char *opt_id)

void ShowExcOpt1(const Exc& exc, const char *opt_id)

There are many various functions providing message boxes. The first word in camel case function name designates the icon used in the message box and possible associated sound. It is followed by the name of buttons and optional Opt or Opt1 part. Opt and Opt1 mean that the dialog has "Do not show this again" option (more on that later).

If there are 2 or 3 buttons, the function returns an int to report which button was pressed. First button listed in the name returns 1, second 0 and third -1 (e.g. in PromptYesNo Yes is 1 and No is 0, in PromptYesNoCancle Yes is 1, No is 0 and Cancel is -1).

If the name contains Opt or Opt1, the process of ignoring the dialog next time is automated via storing specific String key - this key is passed as second const char * parameter to the function - if it is NULL (default), it is generated by hashing the message.

The diference between Opt and Opt1 is that Opt remembers which button was pressed and returns the same value next time (e.g. if in PromptOKCancel "Do not show again" is checked and user presses Cancel, the next the same PromptOKCancel is invoked, it returns without displaying the dialog with 0). As this behaviour can be confusing in certain context, Opt1 variant only grants "Do not show again" request if the user chooses button that returns 1 (e.g. OK or Yes).



void ClearPromptOptHistory()

Clears the list of "Do not show again" message boxes.



void ClearPromptOptHistory(Gate<Stringfilter)

Clears the list of "Do not show again" message boxes - only removes those where filter returns true for opt_id.



void SerializePromptOptHistory(Stream& s)

Serializes the list of "Do not show again" message boxes.



void RedirectPrompts(RedirectPromptFn r)

Completely redirects all message boxes to another function.



Last edit by cxl on 05/31/2021. Do you want to contribute?. T++