Box: Dynamics Ax Message Box

December 23, 2007

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.

Save changes reminder dialog box

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.

  1. box::info(str _text[, str _title, str _bottomText])
  2. box::warning(str _text[, str _title, str _bottomText])
  3. box::stop(str _text[, str _title, str _bottomText])
Dynamics Ax Box::info

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.

  1. box::infoOnce(str heading, str information, URL helpURL, str owner)
  2. box::infoOnceEx(str _heading, str _information, URL _helpURL, str owner, str caption, boolean _detach)
Box::infoOnce

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.

  1. box::yesAllNoAllCancel(str _text, DialogButton _defaultButton [, str _title])
  2. box::yesNoAllNoCancel(str _text, DialogButton _defaultButton [, str _title])
  3. box::yesNoAxaptaForm(str _text, DialogButton _defaultButton [, str _title])
  4. box::yesNoCancel(str _text, DialogButton _defaultButton [, str _title])
  5. box::yesNoOnce(str _title, str _text, DialogButton _defaultButton, str _owner)
  6. box::yesYesAllNoCancel(str _text, DialogButton _defaultButton [, str _title])
Box::yesNoAllCancel

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 :

Super man said... (February 21, 2009 at 2:04 AM)

Dear associate
You are very great!

Thx
Best regard

Anonymous said... (November 27, 2009 at 2:30 PM)

Could not find a suitable section so I written here, how to become a moderator for your forum, that need for this?