Using Dialog Prompts (Discardable Advanced)
Showing dialog prompts displaying the same messages over and over again can be annoying for most end-user. Take the security or alert notifications in your browser, most of us just turn them off after we have read them after they have been shown for the first time, we even discard them without reading them in some cases. EiffelStudio another product full of cases where "discardable" dialogs prompts are a necessity, without them we could hinder and annoy end-users.
Contents
Getting Started
You should already be familiar with the topics detailed in Using Dialog Prompts (Advanced) as the information there applies to discardable dialogs prompts also.
Before continuing you may also want to check out the following pages:
The Need For Discardable Dialog Prompts
One such example of a need for a discardable dialog is performing a finalization compilation. Finalization asks the end-user if they want to discard or keep assertions. For the most part (95%-99% of cases) assertions are always discarded. It makes sense to offer a way to suppress the dialog in the future and perform a default, commonly used, pre-defined action (discarding assertions in this case) when performing a finalization in the future.
Introducing Discardable Dialog Prompt Classes
There are, as of EiffelStudio 6.1, four common discardable dialog prompt classes for use which are somewhat self-explanatory.
- ES_DISCARDABLE_WARNING_PROMPT: Used to display a discardable warning
- ES_DISCARDABLE_INFORMATION_PROMPT: Used to display a piece of informative text that can be discarded in the future.
- ES_DISCARDABLE_QUESTION_PROMPT: Used to ask the user a discardable yes/no question.
All dialog prompt classes are based on an abstract implementation ES_DISCARDABLE_PROMPT, which in turn implements parts of ES_PROMPT.
Extending A Discardable Dialog Prompt
Like the regular dialog prompts (see Using Dialog Prompts (Advanced)), discardable dialog prompts can also be extended. For an example of extension inside EiffelStudio, see the ES_DISCARDABLE_COMPILE_SAVE_PROMPT class. Below shows an extended ES_DISCARDABLE_QUESTION_PROMPT class to create a discardable prompt that informs the user about unsaved modifications to one or more classes in the project, prior to a compilation.