Documents > BPS V2 Script API
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.
Widget loadUiFile (Widget aParent, String aFileName)
 Loads a ui file that was created by the Qt Designer into a widget.
Widget loadUiText (Widget aParent, String aXml)
 Loads a ui XML text that was created by the Qt Designer into a widget.

Variables

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

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;

Function Documentation

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.
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.
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

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