dialog (roll option)

From RPTools Wiki
Revision as of 07:35, 9 January 2009 by Azhrei (talk | contribs) (New page: ==Function dialog== Opens a dialog window. This window can be named; attempts to open another dialog with the same name cause the old contents to be removed and new contents displayed. ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function dialog

Opens a dialog window. This window can be named; attempts to open another dialog with the same name cause the old contents to be removed and new contents displayed. The initial size of the dialog can be specified as well, but once the named dialog is opened and resized by the user, that size becomes its default opening size in the future.

Dialogs are not dockable panels as a Macros:Functions:frame is. Dialogs also have at least one button for dismissing the dialog.

Usage

[h: dialog(dialogName [, size] )]

The first parameter, shown as dialogName, should be a double-quoted string that specifies the internal name of the dialog window. (Note that the title that appears in the titlebar of the window is set separately, using HTML that appears inside the dialog itself.)

The second parameter, shown as size, is optional but is a property string that contains two values, width and height. Those values can be measured in pixels (px and the default) or other HTML units, such as ems (em) or screen width percentages (%).

Examples

The following code opens up a dialog window that contains the HTML as shown here:

[dialog("Dialog Test"): {
  <html>
    <head>
      <title>Test of Dialog Windows</title>
    </head>
    <body>
    <table border="1">
    <tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr>
    <tr><td>Line 1, Col 1</td><td colspan="2">Line 1, Cols 2 and 3</td></tr>
    <tr><td rowspan="2">Lines 2 and 3, Col 1</td><td>Line 2, Col 2</td><td>Line 2, Col 3</td></tr>
    <tr><td>Line 3, Col 3</td><td>Line 3, Col 3</td></tr>
    </table>
    </body>
  </html>
} ]

To create a dialog that initially opens with a width of 300 pixels and height of 200 pixels, change the first line of the previous example to:

[dialog("Dialog Test", "width=300; height=200"): {

Did you try it? It didn't change size from the previous example, did it? Do you remember why? If not, go back to the top of the page and read that first paragraph again!