The displayhtml statement will display a dialog containing HTML. You can control the size of the dialog, as well as several appearance options.
Parameters
This statement has two parameters:html – HTML text to display.
options – This parameter may contain one or more options that alter the operation of the dialog. See the description below for more information.
Description
This statement will display a dialog with HTML text. You can control the size of the dialog, as well as several appearance options. If the dialog has more than one button, info(“dialogtrigger”) will contain the name of the button that was pressed. Here is an example of how this dialog can be used.
displayhtml {<ul><li>One<li>Two<li>Three</ul>},{height=50% width=4in buttons="Open;Cancel"}
The displayhtml statement allows you to display a wide variety of dialogs without having to do any graphics work at all. Of course if you need even more customization you can always create any style you want using a form and the rundialog statement.
The second parameter of the displayhtml statement is a list of options. This list uses a syntax similar to an HTML tag to specify one or more options. Each option is specified as an option=value pair, for example height=300
, title="Enter Quantity"
, etc. Values aren’t required to be quoted unless they contain spaces or special punctuation characters. (Tip: If you enclose the entire option parameter in pipes, curly brackets or “smart quotes” you will be able to use regular " quotes for the individual options, if necessary.)
The sections below describe each of the available displayhtml options.
If you don’t specify otherwise the dialog will be 70 points high and 500 points wide, but you can specify any dimensions you want. By default the dimensions are specified in points (one point = 1/72 inch). This example specifies an alert that is 2 inches high and 4 inches wide.
displayhtml customHTML,{height=144 width=288}
You can also specify the dimensions in inches ("
or in
) or centimeters (cm
), or as a percentage. See the superalert statement for details.
Use the title=
option if you want to display a title at the top of the dialog (in the title bar).
displayhtml customHTML,{title="Choose the type of label"}
If no title option is supplied, the displayhtml statement will use the title in HEAD
section of the supplied HTML
text, if any.
Use the buttons=
option to specify up to two buttons (the default is: Ok and Cancel). Each button is separated by a semicolon, and the first button listed is the default button.
displayhtml customHTML,{buttons="Add;Cancel"}
if info("dialogtrigger")="Add"
... do something for add
elseif info("dialogtrigger")="Cancel"
... do something for cancel
endif
The buttons will be displayed in the bottom right corner of the alert. They are displayed in reverse order. In the example above, the Add button is on the far right and is the default button. The Cancel button is displayed to its left.
The default button width is 80 points, you can also specify a button width in points by placing a colon followed by the width after the button name.
displayhtml customHTML,{buttons="Submit:120;Cancel:80"}
Normally you set up a button for cancelling the dialog (see above). However, you can also enable the dialog’s close button (the red button in the upper left corner of the dialog) to perform this function. Use the true/false closewindowbutton=
option to do this.
displayhtml customHTML,{ ... closewindowbutton=yes ... }
Normally the dialog’s maximization button (the green button in the upper left) is enabled, allowing the user to click to “zoom” the dialog to maximum size. If you want to disable this option, use the maximizablewindow=
option, like this:
displayhtml customHTML,{ ... maximizablewindow=no ... }
See Also
History
Version | Status | Notes |
10.0 | New | New in this version. |