There are scenarios where the system requires prompt user attention. The system may require decision from the user before proceeding, or having to inform the user of something important. This is usually done by freezing the application forcing the user to interact with a child window. This child window is known as a modal window.
An example could be found when you close a window after modifying the record. You will see a dialog box asking you whether you want to save changes. The following figure shows the window we are referring to.
Those experienced with other development platform might have searched for message box. In Dynamics Ax, this is achieved with the class Box. You may find it at AOT > Classes > Box. The methods to call various types of modal dialog boxes are visible.
Type 1: Notify user
This group produces a dialog box with an OK button. They are mainly used to notify user of something. There are three dialog boxes in this group with different icon; information, warning and error. The following are the three methods that produce this type of box. This is followed by a figure that shows a sample of such dialog box.
- box::info(str _text[, str _title, str _bottomText])
- box::warning(str _text[, str _title, str _bottomText])
- box::stop(str _text[, str _title, str _bottomText])
Type 2: Detail Information Notification
This type of dialog box is meant to provide detail information. There is an option to provide link to further information. There is also an option to not show the dialog again.
There are two methods that produce such dialog box. The second one is an extended version of the first where the ability to define caption is available.
- box::infoOnce(str heading, str information, URL helpURL, str owner)
- box::infoOnceEx(str _heading, str _information, URL _helpURL, str owner, str caption, boolean _detach)
Type 3: Request for Decision
This group provides more than one buttons that require user decision. They come with various buttons combinations. The button combination is denoted in the method name. The most common are OK Cancel and No Yes.
There is one such dialog box that offers the option not to show the dialog box again. It is a dialog box with Yes and No button plus a Do not ask again checkbox. This is achieved with the method box::yesNoOnce.
The following are the list of methods which also denotes their button combination. This is followed by a figure showing a sample of such dialog boxes.
- box::yesAllNoAllCancel(str _text, DialogButton _defaultButton [, str _title])
- box::yesNoAllNoCancel(str _text, DialogButton _defaultButton [, str _title])
- box::yesNoAxaptaForm(str _text, DialogButton _defaultButton [, str _title])
- box::yesNoCancel(str _text, DialogButton _defaultButton [, str _title])
- box::yesNoOnce(str _title, str _text, DialogButton _defaultButton, str _owner)
- box::yesYesAllNoCancel(str _text, DialogButton _defaultButton [, str _title])
Summary
The message box facility in X++ is fairly well done. The parameters are self descriptive. We are offered up to date feature such as the Do not ask again checkbox. In case there are more types required, the class Box could be easily extended to provide more choices.
2 responses :
Dear associate
You are very great!
Thx
Best regard
Could not find a suitable section so I written here, how to become a moderator for your forum, that need for this?
Add your opinion