frame (roll option): Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Dialog references scrubbed, new image of example frame, changed example code window title)
m (Added notice of and workaround for potentially library token related bug, minor readability/clarity edits)
Line 2: Line 2:
|name=frame
|name=frame
|description=
|description=
Opens a frame window.  This window can be named; attempts to open another frame with the same name cause the old contents to be removed and new contents displayed.  Once the named frame is opened and resized by the user, that size becomes its default opening size in the future.
Opens a frame window.  Unlike the modeless {{roll|dialog}}, frames are dockable panels that are usually intended to remain open. Frames can be closed with a button located in the title bar.
 
Frames are dockable panels, unlike the modeless {{roll|dialog}}. Frames only have a single button for dismissing the frame, located in the title bar.


|usage=
|usage=
Line 11: Line 9:
</source>
</source>


The first parameter, shown as '''frameName''', should be a double-quoted string that specifies the internal name of the frame window.  (Note that the title that appears in the title bar of the window is set separately, using HTML that appears inside the frame itself.) (use '''title''' parameter from b50 forward)
The first parameter, shown as '''frameName''', should be a double-quoted string that specifies the internal name of the frame window.  The visible title that appears in the title bar of the window is set separately, either by using HTML that appears inside the frame itself or use of the '''title''' parameter from b50 forward.  Any attempts to open another frame with the same name instead cause the old contents to be removed and new contents displayed.  Note this behavior relates to the internal name of the frame, not the displayed title of the frame as multiple frames can share a title.  Once the named frame is opened and resized by the user, that size becomes its default opening size in the future, unless the temporary option is set to "1".
 
 
The second parameter is optional, it is a semicolon separated [[property string]], which could include the following options:
 
The '''temporary''' option dictates whether Maptool remembers the size of the frame between displays.  Setting this value to 1 causes Maptool to forget the window size.  Example "temporary=1"


The second parameter is optional, it is a semicolon separated [[property string]], which could include the following parameters:
The '''title''' option sets the title of the frame and replaces the need to set the title from within the HTML code.


The '''temporary''' parameter dictates whether Maptool remembers the size of the frame between displays.  Setting this value to 1 causes Maptool to forget the window size.  Example "temporary=1"


The '''title''' parameter sets the title of the frame and replaces the need to set the title from within the HTML code.
It appears there may be a bug related macros on a library token that open a frame. Calls to the macro after closing the frame may not show the frame. This can be remedied by adding a line to the calling macro before running the library macro. Use the line below, substituting your own frame name.
<source lang="mtmacro" line>
[ if( isFrameVisible("YourFrame") ), code: {}; { [resetFrame("YourFrame")] } ]
</source>
This checks if the bugged frame is visible or not. If the frame is open it does nothing, but if it is closed it resets the frame, which forces it to be shown.


|examples=
|examples=

Revision as of 03:54, 25 May 2009

[frame():] Roll Option

Opens a frame window. Unlike the modeless [dialog():], frames are dockable panels that are usually intended to remain open. Frames can be closed with a button located in the title bar.

Usage

[h: frame(frameName [,"temporary; title"] )]

The first parameter, shown as frameName, should be a double-quoted string that specifies the internal name of the frame window. The visible title that appears in the title bar of the window is set separately, either by using HTML that appears inside the frame itself or use of the title parameter from b50 forward. Any attempts to open another frame with the same name instead cause the old contents to be removed and new contents displayed. Note this behavior relates to the internal name of the frame, not the displayed title of the frame as multiple frames can share a title. Once the named frame is opened and resized by the user, that size becomes its default opening size in the future, unless the temporary option is set to "1".


The second parameter is optional, it is a semicolon separated property string, which could include the following options:

The temporary option dictates whether Maptool remembers the size of the frame between displays. Setting this value to 1 causes Maptool to forget the window size. Example "temporary=1"

The title option sets the title of the frame and replaces the need to set the title from within the HTML code.


It appears there may be a bug related macros on a library token that open a frame. Calls to the macro after closing the frame may not show the frame. This can be remedied by adding a line to the calling macro before running the library macro. Use the line below, substituting your own frame name.

[ if( isFrameVisible("YourFrame") ), code: {}; { [resetFrame("YourFrame")] } ]

This checks if the bugged frame is visible or not. If the frame is open it does nothing, but if it is closed it resets the frame, which forces it to be shown.

Examples

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

[frame("Frame Test"): {
  <html>
    <head>
      <title>Test of Frame 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>
} ]

See Also

[dialog():]
Introduction to Dialogs and Frames