BOX CLASS
Boxes display brief messages to
application users. There are many box types and each has their own box method.
Methods in the box class take the
following parameters:
• The main text
• The title bar text
• Help text
The following is an example of an
information box and how the parameters are used:
Box::info("Main Text", "Title", "This is the
help text");
The following figure shows the resulting window.
The string "This is the help
text" appears in the status bar at the bottom of the screen.
The box class contains many
methods that create different types of boxes. These methods can be viewed in
the AOT under Classes > Box. Many boxes only provide output to
the user, where as other boxes accept input from the user, depending on which
button the user clicks.
Some of the more commonly used
boxes are discussed in this lesson. The warning box is used to display
warning messages.
The following example shows how
the warning message is used:
Box::warning ("This is a warning message.", "Title
text", "Help text");
The resulting box is shown on the display.
The following example shows a YesNo box:
Box::yesNo("Choose Yes or No", DialogButton::Yes, "Yes
No Box Example", "Answer Yes or No");
The resulting box is shown on the display.
Notice the additional required
parameter DialogButton::Yes. This parameter specifies a default button.
Notice on the YesNo box that the Yes button is selected as the
default.
The following is an example of
how X++ accepts user input and executes statements based on this input:
DialogButton
dialogButton;
dialogButton=
Box::yesNo("Choose Yes or No",
DialogButton::Yes, "Yes No Box Example");
if (dialogButton == DialogButton::Yes)
{
print "You chose Yes";
pause;
}
else
if (dialogButton == DialogButton::No)
{
print "You chose No";
pause;
}
The box function returns a
value of the enum DialogButton that can be used to determine which
option the user chooses.
No comments:
Post a Comment