Banana.Ui

Cette documentation est dépassée

La documentation la plus complète et actualisée est celle de Banana Comptabilité Plus : Essayez-le maintenant

In this article

This class Banana.Ui contains methods to interact with user interface.

Methods

createUi(uiFilePath)

Read the file uiFilepath and return an object representing the dialog. The uiFileName has to be in the same directory as the running script. For details and examples see Script dialogs.

If an error occurred undefiend is returned.

Example:

@includejs = ch.banana.calculator.dialog.js;  // Define the class Calculator
                                              // that control the .ui file
...
var calculatorUi = Banana.Ui.createUi("ch.banana.calculator.dialog.ui");
var calcJs = new Calculator(calculatorUi); 
calclatorUi.exec();  //Show the dialog

Introduced in 7.0.4.0

createQml(qmlFilePath)

This is a test implementation with QtQuick 1.0 and will change in future as soon QtQuick 2.0 is implemented in Banana Accounting.

Read the file qmlFilepath and return an object representing the qml dialog. The qmlFilePath has to be in the same directory as the running script. The returned object has the property qmlObject to access the qml items.

Security notes: qml files have to resides inside a rcc resource file, if not an exception is thrown. Qml applications doesn't have access to the internet. Qml applications have read access to all files stored in your computer.

If an error occurred undefiend is returned.

Example:

var calculator = Banana.Ui.createQml("ch.banana.calculator.qml");
calculator.exec(); //Show the dialog
calcQmlObj = calculator.qmlObject;
var result = calcQmlObj.getDisplay();

Introduced in 7.0.5.0

getDouble(title, label [, value , min, max, decimals])

Show the user a dialog asking to insert a double. Return the inserted double or undefined if the user clicked cancel.

Introduced in 7.0.5.0

getInt(title, label [, value, min, max, steps])

Show the user a dialog asking to insert a integer. Return the inserted integer or undefined if the user clicked cancel.

Introduced in 7.0.5.0

getItem(title, label, items [, current, editable])

Show the user a dialog asking to select an intem from a list. Return the selected item or undefined if the user clicked cancel.

Example:

value = Banana.Ui.getItem("Input",
   "Choose a value",  
   ["a","b","c","d","e"],
   2,
   false)

Introduced in 7.0.5.0

getPeriod(title, startDate, endDate [, selectionStartDate, selectionEndDate, selectionChecked])

Show the user a dialog asking to select a period like the tab Period. Return an object with the atributes 'startDate', 'endDate' and 'hasSelection' or undefined if the user clicked cancel. Date values are in the format "YYYY-MM-DD".

Introduced in 7.0.5.0

getText(title, label [, text])

Show the user a dialog asking to insert a text. Return the inserted text or undefined if the user clicked cancel.

Introduced in 7.0.5.0

showHelp(uiFileName)

Show the help of a dialog. The help is loaded from the Banana.ch web site.

Introduced in 7.0.4.0

showInformation(title, msg)

Show the user a information dialog.

Introduced in 7.0.5.0

showQuestion(title, question)

Show the user a question dialog with Yes and No buttons. Return true if the user clicked Yes, otherwise false.

Introduced in 7.0.5.0

showText(text)

Show the given text in a dialog. The text can be plain text of html and span over multiple lines. If the text is in html the title is taken form the html. The dialog enable the user to save the content in the formats html, pdf, odf and txt.
The use of pixels to set  the font sizes is not supported, the text is not rendered properly.

Introduced in 7.0.5.0

showText(title, text)

This is an overloaded function.

Show the given text in a dialog with the given title. The text can be plain text of html and span over multiple lines. The dialog enable the user to save the content in the formats html, pdf, odf and txt.

Introduced in 7.0.5.0