BPS Script API  2.24.4
bps::gui Namespace Reference

The bps.gui extension is a namespace assembling GUI properties and functions. More...

Classes

class  MessageBox
 A class to display message boxes. More...
 

Functions

Number exec ()
 Executes the event loop for standalone GUI scripts. More...
 
Widget loadUiFile (Widget aParent, String aFileName)
 Loads a ui file that was created by the Qt Designer into a widget. More...
 
Widget loadUiText (Widget aParent, String aXml)
 Loads a ui XML text that was created by the Qt Designer into a widget. More...
 

Variables

QString uiFileName
 This is a convenience UI filename suggestion, derived from the script name. More...
 

Detailed Description

The bps.gui extension is a namespace assembling GUI properties and functions.

The extension needs to be loaded before it can be used. Note that the bps extension will automaticly be loaded before the bps.gui extension:

var retval = 0;
if (isGui) {
importExtension('bps.gui');
with (bps.gui) {
var ui = loadUiFile(0, uiFileName);
ui.show();
retval = exec();
}
} else {
perror('This is a GUI script. Please run it by gui.exe, not by bps.exe.');
retval = 1;
}
retval;
void perror(...)
Print the expressions (applying toString() if necessary) to the console error output (stderr),...
Boolean isGui
GUI environment indicator.
Definition: Global.js:22
void importExtension(String aExtensionName)
Imports the named extension into the script engine.
The bps.gui extension is a namespace assembling GUI properties and functions.
Definition: bps.gui.js:24
Number exec()
Executes the event loop for standalone GUI scripts.
Widget loadUiFile(Widget aParent, String aFileName)
Loads a ui file that was created by the Qt Designer into a widget.
QString uiFileName
This is a convenience UI filename suggestion, derived from the script name.
Definition: bps.gui.js:30
The bps extension is a namespace assembling general BPS properties and functions.
Definition: bps.AsyncIO.js:1

Function Documentation

◆ exec()

Number bps::gui::exec ( )

Executes the event loop for standalone GUI scripts.

Call this after showing a non-modal main widget.

Returns
The exit code.

◆ loadUiFile()

Widget bps::gui::loadUiFile ( Widget  aParent,
String  aFileName 
)

Loads a ui file that was created by the Qt Designer into a widget.

Parameters
aParentParent widget object. Pass 0 if there is no parent.
aFileNameName of the ui file to load.
Returns
The widget that was loaded.
Exceptions
Errorthrown when file can not read, or the ui content not processed without error.

◆ loadUiText()

Widget bps::gui::loadUiText ( Widget  aParent,
String  aXml 
)

Loads a ui XML text that was created by the Qt Designer into a widget.

Parameters
aParentParent widget object. Pass 0 if there is no parent.
aXmlThe XML code describing the widget.
Returns
The widget that was loaded.
Exceptions
Errorwhen the ui content not processed without error.

Variable Documentation

◆ uiFileName

QString bps::gui::uiFileName

This is a convenience UI filename suggestion, derived from the script name.

If scriptFileName is for example C:\test\hello.js, then uiFileName will be set to C:\test\hello.ui