Syntax
| mio_dialog_html(title, htmlFile, buttons, width,height, functionName, parentID, x,y) |
Parameters
| STRING | title | Optional. Title of the dialog box. If this parameter is set to an empty string, the application title is used. The application title is defined with app.init or app.title.
| | STRING | htmlFile | HTML document to be loaded. Local files, network files and URLs are supported.
| | STRING | buttons | List of buttons in the bottom of the dialog box, with | as separator. You can define tree buttons as follow: button A|button B|button C
| | INT,INT | width,height | Optional. Size of the dialog box. If set to an empty string, the size of the dialog box is set to 300 pixels width and 120 pixels height.
| | CALLBACK | functionName | Optional. Name of the function to be called when the dialog box is closed.
| | ID | parentID | Optional. ID of the parent window. When a parent window is specified, the dialog box will always be in front of the parent window, and will be displayed in the same monitor than the specified window. You can use the string "main" to designate the main window ID.
| | INT,INT | x,y | Optional. Position of the dialog box in the screen. If set to an empty string, the dialog box is centered in the screen. |
Return value
No value is returned.
Description
Displays an HTML document in a dialog box with up to three buttons.
The HTML document can be online or local. Just specify the name of the file with no path if the HTML file is in the resources folder (path.rsc).
If Enter is pressed when the dialog box is visible, the callback function is called with the index set to 0 (first button).
Callback Function| |
The JavaScript code is not stopped when the dialog box is displayed.
When the user clicks a button, the callback function functionName is called with the index of the button as first argument.
|
Script onBeforeDialogClose| |
Instead of using a callback function, you can set a script in the dialog box HTML document to be executed when the user click on a push button. In this script, the string {choice} is replaced by the index of the button clicked by the user.
The script should be defined as follow:
<script event="onBeforeDialogClose">
if({choice} == 0) {
// User choose Ok...
}
</script>
|
|
See also: mio_dialog.
In addition to mioEngine.js, this function requires gui.k.
This function can be called from MioScript with dialog.html. |
JavaScript Sample Code
// Sample HTML document calling a dialog box.
// The file dialog.htm is loaded in the dialog box.
<HTML>
<script src="mioEngine.js"></script>
<script>
function showDialog() {
mio_dialog_html("myApp", "dialog.htm", "Ok|Cancel", 300, 100, "dialog_cb")
}
function dialog_cb(choice) {
alert(choice)
}
</script>
<BODY>
<INPUT type="button" value="Show Dialog" onClick="showDialog()">
</BODY>
</HTML> |
|