Difference between revisions of "Tool Dialog Prompts"

m (Consistent Look and Feel)
m
 
(25 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:EiffelStudio]]
 
[[Category:EiffelStudio]]
[[Category:Extending_EiffelStudio]]
+
[[Category:Extending EiffelStudio]]
{{UnderConstruction}}
+
[[Category:EiffelStudio Foundations]]
  
 
Dialog prompts are an essential part of [[Tool Integration Development]] and [[Services]] in EiffelStudio. As such we have provide a number of EiffelStudio specific classes for creating and displaying EiffelStudio dialog prompts.
 
Dialog prompts are an essential part of [[Tool Integration Development]] and [[Services]] in EiffelStudio. As such we have provide a number of EiffelStudio specific classes for creating and displaying EiffelStudio dialog prompts.
  
 
== Consistent Look and Feel ==
 
== Consistent Look and Feel ==
As of EiffelStudio 6.1 ([[EiffelStudio 6.1 Releases]]), EiffelStudio uses custom dialog prompts that come in a flavor of presentation that stands above the stock dialog prompts found in EiffelVision2. As such all dialog prompts in EiffelStudio should be using the new prompt classes instead of those found in EiffelVision2 or the slightly specialized versions found in previous versions of EiffelStudio.
+
As of [[:Category:EiffelStudio|EiffelStudio]] [[EiffelStudio_6.1_Releases|6.1]], [[:Category:EiffelStudio|EiffelStudio]] uses custom dialog prompts that come in a flavor of presentation that stands above the stock dialog prompts found in [[:Category:EiffelVision2|EiffelVision2]]. As such all dialog prompts in EiffelStudio should be using the new prompt classes instead of those found in [[:Category:EiffelVision2|EiffelVision2]] or the slightly specialized versions found in previous versions of [[:Category:EiffelStudio|EiffelStudio]].
  
 
Just to get an idea of what the new prompts look like, here’s an example:
 
Just to get an idea of what the new prompts look like, here’s an example:
  
[[Image:Dialog_prompts_example_question.png|thumb|331px|left|New prompts in EiffelStudio]]
+
[[Image:Dialog_prompts_example_question.png|New prompts in EiffelStudio]]
  
== Displaying Dialog Prompts, the Easy Way ==
+
For more examples of the new dialog prompts in [[:Category:EiffelStudio|EiffelStudio]] [[EiffelStudio_6.1_Releases|6.1]] see [[Taxonomy of Dialog Prompts]].
Instead of creating dialog prompts and displaying them using the <eiffel>ES_XXX_PROMPT</eiffel> classes directly you can use a help class <eiffel>ES_PROMPT_PROVIDER</eiffel> (or inherit the shared class <eiffel>ES_SHARED_PROMPT_PROVIDER</eiffel> and access <eiffel>prompts</eiffel>.) Of course, the easy way does limit functionality but for the vast majority of cases the routines of <eiffel>ES_PROMPT_PROVIDER</eiffel> provide all that is needed.
+
  
Note: For tool and dialog development <eiffel>ES_DOCKABLE_TOOL_WINDOW</eiffel> and <eiffel>ES_DIALOG</eiffel> both inherit <eiffel>ES_SHARED_PROMPT_PROVIDER</eiffel> and provide access to a shared instance of <eiffel>ES_PROMPT_PROVIDER</eiffel> through a feature <eiffel>prompts</eiffel>.
+
== New Features ==
 +
The new dialog prompts in EiffelStudio no only have an update look and feel to them but the come with a number of added benefits for both end-users and EiffelStudio tool developers:
  
<eiffel>ES_PROMPT_PROVIDER</eiffel> provides a quick means to display dialog prompts and associate any actions with the default buttons created on the prompts. The routine are self explanatory, Each routine shows the prompt specific to the situation, <eiffel>show_error_prompt</eiffel> will show an error prompt, <eiffel>show_warning_prompt</eiffel> shows an warning prompt, <eiffel>show_info_prompt</eiffel> shows an information prompt and finally, show_question_prompt show a prompt designated for asking the user a question.
+
* Brand new look.
 +
* Automatic layout of widgets and other text.
 +
* Button layouts are platform-dependent ('''Ok'''|'''Cancel''' on Windows, '''Cancel'''|'''Ok''' on Mac OSX.)
 +
* Dual-model; providing agent actions to perform on button presses and/or retrieval of the dialog result code.
 +
* Simplified interfaces with less code to write.
 +
* Extendable (see [https://eiffelsoftware.origo.ethz.ch/svn/es/trunk/Src/Eiffel/interface/new_graphical/dialogs/prompts/es_discardable_compile_save_files_prompt.e ES_DISCARDABLE_COMPILE_SAVE_PROMPT].)
 +
* Provides both standard and advanced creation routines for quick or complex creation.
 +
* An abstraction that makes it easy to replace the prompts in the future, updating the look etc.
 +
* Dialog prompts are always modal to the parent window.
 +
* Automatic location of the last active EiffelStudio window so tools need not worry about window management.
 +
* Automatic key navigation binding; Use of {{key|TAB}}, {{key|LEFT}} or {{key|RIGHT}} cursor keys and button first(or next)-character key ('''Yes''' => {{key|Y}}, '''Create''' => {{key|C}}, ...)
 +
* Ability to set a default active button.
  
There are the <eiffel>show_xxx_with_cancel</eiffel> variants, which includes a cancel button along with the standard set of buttons.
+
== Choosing a Dialog Prompt ==
 +
Making the correct choice as to which dialog prompt to display is crucial, and is not as easy as you think. There is a page dedicate to deciding what dialog prompt is best suited for the need of a particular message - [[Taxonomy of Dialog Prompts]]. For help on choosing and formatting dialog prompt messages, see [[Dialog Prompt Messages and Formatting]].
  
=== Prompt Arguments ===
+
== Displaying Dialog Prompts, the Easy Way ==
Using <eiffel>ES_PROMPT_PROVIDER</eiffel> does not provide any means to custom the dialog prompts instead its purpose is for the quick creation and display of standard dialog prompts.
+
For the simplest way to show dialog prompts inside [[:Category:EiffelStudio|EiffelStudio]] or to use dialog prompts in the Eiffel [https://eiffelsoftware.origo.ethz.ch/svn/es/trunk/Src/framework/ framework library] see [[Using Dialog Prompts (Basic)]].
 
+
Every <eiffel>show_xxx_prompt</eiffel> routine requires a message string, which relates to the message the user is shown.
+
 
+
The argument specifying the parent window to display the prompt to is optional. If <eiffel>Void</eiffel> is passed for this argument then the last focused window/dialog is used as the parent window or the last active EiffelStudio IDE main window.
+
 
+
The other routine arguments are for any actions that should be associated with a button press in the prompt. Simply pass an appropriate agent or <eiffel>Void</eiffel> to specify no action.
+
 
+
=== Using Dialog Prompts In the Eiffel Framework ===
+
ES_PROMPT_PROVIDER and ES_SHARED_PROMPT_PROVIDER are accessible from the Eiffel framework library, however the underlying implementation in the framework library actually uses the older EB_XXX_DIALOGs instead of the new ES_XXX_PROMPT classes.
+
 
+
The new ES_XXX_PROMPT rely on classes found in the EiffelStudio IDE so for the sake of compatibility the old EB_XXX_DIALOG classes have not been removed from the framework. This means when you are developing with the framework library outside of the EiffelStudio (target bench) project you will see the older dialog prompts, this is normal. Once your code is integrated into the EiffelStudio project, even if it is referenced as a library by the project, you code will automatically use the new dialog prompts for EiffelStudio. Under no circumstances should you be using the EB_XXX_DIALOG dialog prompt classes directly, please use the routines of ES_PROMPT_PROVIDER.
+
 
+
This transparent switching of implementation is accomplished by using an override cluster in the EiffelStudio (target bench) project, overriding the default implementation in the framework library with the EiffelStudio specific implementation.
+
 
+
Note: The transparent switching is done through overriding the default implementation of ES_PROMPT_PROVIDER and not any of the EB_XXX_DIALOG classes! If you use the EB_XXX_PROMPT classes directly you will see no change with integrating you code. All the EB_XXX_PROMPT classes have been marked obsolete so the only obsolete warnings you should see if those from ES_PROMPT_PROVIDER.
+
 
+
=== An Example, the Easy Way ===
+
 
+
To simply demonstrate the use of <eiffel>ES_PROMPT_PROVIDER</eiffel> by inheriting the shared class <eiffel>ES_SHARED_PROMPT_PROVIDER</eiffel>, the code below is all that is needed to show an Error prompt on the IDE window, with the message <eiffel>"This is an Error prompt"</eiffel>.
+
 
+
<eiffel>
+
prompts.show_error_prompt ("This is an Error prompt", Void, Void)
+
</eiffel>
+
 
+
The result of executing the above code results in a dialog prompt like the one below:
+
 
+
[[Image:Dialog_prompts_example_error.png]]
+
 
+
To get a little more into prompts, here's a confirmation prompt that performs actions when pressing a button. Note, inline agents are used here just for the purpose of brevity.
+
<eiffel>
+
prompts.show_question_prompt ("If you press Yes, I'll tell you something...", Void,
+
  agent
+
    do
+
        -- Agent action for 'Yes' button.
+
      prompts.show_info_prompt ("You pressed Yes!", Void, Void)
+
    end,
+
  agent
+
    do
+
        -- Agent action for 'No' button.
+
      prompts.show_error_prompt ("You should have pressed Yes!", Void, Void)
+
    end
+
  )
+
</eiffel>
+
 
+
The result of executing the above code results in a dialog prompt like the one below:
+
 
+
[[Image:Dialog_prompts_example_question.png]]
+
 
+
Pressing the '''Yes''' button on the question dialog prompt produces the dialog prompt:
+
 
+
[[Image:Dialog_prompts_example_question_info.png]]
+
  
Pressing the '''No''' button on the question dialog prompt produces the dialog prompt:
+
== Displaying Dialog Prompts, the Other Way ==
 +
For more control over the way dialog prompts are display and how users interact with them, see [[Using Dialog Prompts (Advanced)]].
  
[[Image:Dialog_prompts_example_question_error.png]]
+
== Displaying Discardable Dialog Prompts ==
 +
The final set of dialog prompts are discardable dialog prompt. Discardable dialog prompts allows the user to opt out of seeing the dialog prompt subsequent showings. For information on using discardable dialog prompts, see [[Using Dialog Prompts (Advanced Discardable)]].

Latest revision as of 09:16, 14 May 2008


Dialog prompts are an essential part of Tool Integration Development and Services in EiffelStudio. As such we have provide a number of EiffelStudio specific classes for creating and displaying EiffelStudio dialog prompts.

Consistent Look and Feel

As of EiffelStudio 6.1, EiffelStudio uses custom dialog prompts that come in a flavor of presentation that stands above the stock dialog prompts found in EiffelVision2. As such all dialog prompts in EiffelStudio should be using the new prompt classes instead of those found in EiffelVision2 or the slightly specialized versions found in previous versions of EiffelStudio.

Just to get an idea of what the new prompts look like, here’s an example:

New prompts in EiffelStudio

For more examples of the new dialog prompts in EiffelStudio 6.1 see Taxonomy of Dialog Prompts.

New Features

The new dialog prompts in EiffelStudio no only have an update look and feel to them but the come with a number of added benefits for both end-users and EiffelStudio tool developers:

  • Brand new look.
  • Automatic layout of widgets and other text.
  • Button layouts are platform-dependent (Ok|Cancel on Windows, Cancel|Ok on Mac OSX.)
  • Dual-model; providing agent actions to perform on button presses and/or retrieval of the dialog result code.
  • Simplified interfaces with less code to write.
  • Extendable (see ES_DISCARDABLE_COMPILE_SAVE_PROMPT.)
  • Provides both standard and advanced creation routines for quick or complex creation.
  • An abstraction that makes it easy to replace the prompts in the future, updating the look etc.
  • Dialog prompts are always modal to the parent window.
  • Automatic location of the last active EiffelStudio window so tools need not worry about window management.
  • Automatic key navigation binding; Use of TAB, LEFT or RIGHT cursor keys and button first(or next)-character key (Yes => Y, Create => C, ...)
  • Ability to set a default active button.

Choosing a Dialog Prompt

Making the correct choice as to which dialog prompt to display is crucial, and is not as easy as you think. There is a page dedicate to deciding what dialog prompt is best suited for the need of a particular message - Taxonomy of Dialog Prompts. For help on choosing and formatting dialog prompt messages, see Dialog Prompt Messages and Formatting.

Displaying Dialog Prompts, the Easy Way

For the simplest way to show dialog prompts inside EiffelStudio or to use dialog prompts in the Eiffel framework library see Using Dialog Prompts (Basic).

Displaying Dialog Prompts, the Other Way

For more control over the way dialog prompts are display and how users interact with them, see Using Dialog Prompts (Advanced).

Displaying Discardable Dialog Prompts

The final set of dialog prompts are discardable dialog prompt. Discardable dialog prompts allows the user to opt out of seeing the dialog prompt subsequent showings. For information on using discardable dialog prompts, see Using Dialog Prompts (Advanced Discardable).