Dialog Boxes |
|
Regular Dialog Boxes |
Introduction |
A dialog box is a form with particular properties. Like a form, a dialog box is referred to as a container. It is the primary interface of user interaction with the computer. By itself, a dialog box means nothing. The controls it hosts accomplish the role of dialog between the user and the machine. Here is an example of a dialog box: A dialog box has the following characteristics:
|
Dialog Box Creation |
There are two main actions you can perform on a form to qualify it as a dialog box (but normally, these are only suggestions, not rules). Based on the Microsoft Windows design and standards, to create a dialog box:
Often the user will be presented with various options on a dialog box and may be asked to make a decision on the available controls. Most of the time, if you are creating such a dialog box, besides the OK button, it should also have a Cancel button. The OK button should be the default so that if the user presses Enter, the dialog box would be closed as if the user had clicked OK. Clicking OK or pressing Enter would indicate that, if the user had made changes on the controls of the dialog box, those changes would be acknowledged and kept when the dialog box is closed. The changed values of the control would be transferred to another dialog box or form. To fulfill this rule for the OK button, after adding the button(s), click the form to select it. Then, click its AcceptButton field in the Properties window. This reveals its combo box. Click its arrow and select the name of the button whose action would be performed when the user presses Enter. The Cancel button is used to allow the user to dismiss whatever changes would have been made on the controls of the dialog box. The dialog box should also be configured so that if the user presses Esc, the dialog box would be closed as if the user had clicked Cancel. |
Modal and Modeless Dialog Boxes |
Modal Dialog Boxes |
There are two types of dialog boxes: modal and modeless. A Modal dialog box is one that the user must first close in order to have access to any other form or dialog box of the same application. One of the scenarios in which you use a dialog box is to create an application that is centered around one. In this case, if either there is no other form or dialog box in your application or all the other forms or dialog boxes depend on this central dialog box, it must be created as modal. Such an application is referred to as dialog-based. Some applications require various dialog boxes to complete their functionality. When in case, you may need to call one dialog box from another and display it as modal. |
The Date and Time dialog box of WordPad is an example of a modal dialog box: if opened, the user must close it in order to continue using WordPad. |
After creating a form and configuring it as a dialog box, to call it as modal, use the ShowDialog() method. |
Modeless Dialog Boxes |
A dialog box is referred to as modeless if the user does not have to close it in order to continue using the application that owns the dialog box: |
The Find dialog box of WordPad (also the Find dialog box of most applications) is an example of a modeless dialog box. If it is opened, the user doesn't have to close in order to use the application or the document in the background. |
A modeless dialog box should/must not display its button on the task bar. The user should still know that the dialog box is opened. To make the presence of a modeless dialog box obvious to the user, it typically displays on top of its host application until the user closes it. A modeless dialog box is created from a form but it should look like a regular dialog box or a tool window. Therefore, to create a modeless dialog box, set the FormBorderStyle property to an appropriate value such as FixedSingle, FixedToolWindow, Sizable or SizableToolWindow. Also, set its ShowInTaskbar property to False. |
|
||
Previous | Copyright © 2003-2015, FunctionX | |
|