Previous Document Next Document

Making macros user-friendly : Providing dialog boxes for macros


Providing dialog boxes for macros

A dialog box provides a user-friendly interface for more complex macro solutions.

For best results, all dialog boxes must provide the following:

 
a meaningful title
 
an obvious function for cancelling or closing the dialog box
 
an easy-to-use layout
 
a Help button from which users can access how-to documentation
 
a tooltip (that is, a ControlTipText string) for every control

There are two types dialog boxes: modal and modeless.

Understanding modal dialog boxes

A modal dialog box locks the application until the user acts on and then closes the dialog box. Most built-in dialog boxes for macro solutions are modal, and most modal dialog boxes provide the following buttons:

 
OK — performs an action and then closes the dialog box. This button is the default.
 
Cancel — closes the dialog box without performing an action. This button provides the same functionality as the Close button in the upper-right corner of a dialog box.

In addition, some modal dialog boxes provide the following button:

 
Apply — performs an action that can be commited by clicking the OK button or cancelled by clicking the Cancel button

Finally, most wizard-style dialog boxes provide the following buttons:

 
Previous — returns to the previous page. This button can be disabled on the first page of the dialog box.
 
Next — advances to the next page. This button can be replaced by a Finish button on the last page of the dialog box.
 
Finish — performs the action for the dialog box and then closes the dialog box
Understanding modeless dialog boxes

A modeless dialog box does not lock the application, so the user can leave the dialog box open and continue working in the application. In this way, modeless dialog boxes behave like dockers. Most modeless dialog boxes provide the following buttons:

 
Apply or Create — performs an action (and can, in fact, be specially labeled to describe that action). This button is typically the default.
 
Close –– closes the dialog box. This button is used after the action is applied.
Choosing between modal and modeless dialog boxes

Before you can create a dialog box for your macro solution, you must decide whether to make it modal or modeless by considering what you want the dialog box to achieve.

For example, let’s say that you are creating a “one-shot” end-to-end solution such as a customized Print dialog box or Save dialog box. In this case, you would provide a modal dialog box because it is unlikely that the user would want to apply the specified settings repeatedly.

On the other hand, let’s say that you are creating a solution for setting up an effect to apply to a selection of shapes. To let the user specify the desired settings and then apply them repeatedly, you would provide a modeless dialog box.

After choosing which type of dialog box to provide, you are ready to set it up. For information, see Setting up dialog boxes.

After setting up a dialog box, you are ready to code it. For information, see Coding dialog boxes.

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.