FMOD Studio User Manual 2.02

26. Scripting API Reference | UI

Module: UI

The studio.ui module allows you to create user interfaces.

ui.showModalDialog(description)

Displays a dialog window. The function returns once the dialog has been closed.

See ui.showModelessDialog(description) for further information about the widget description argument.

ui.showModelessDialog(description)

Displays a dialog window. The function returns once the dialog is shown.

The layout of the dialog is based on a widget description object, which contains the following attributes:

Applicable to the root widget description in a dialog:

Applicable to widgetType.Layout:

Applicable to items within a layoutType.HBoxLayout or layoutType.VBoxLayout:

Applicable to items within a layoutType.GridLayout:

Applicable to widgetType.Label:

Applicable to widgetType.PushButton:

Applicable to widgetType.LineEdit:

Applicable to widgetType.TextEdit:

Applicable to widgetType.ComboBox:

Applicable to widgetType.CheckBox:

Applicable to widgetType.Slider:

Applicable to widgetType.SpinBox:

Applicable to widgetType.PathLineEdit:

Note that all attributes are optional except for those marked as required.

Widget callbacks functions are called with the this value set to the corresponding widget. You can dynamically get and set the various attributes available in the widget description using the corresponding 'getter' and 'setter' (e.g. calling widget.setVisible() will modify the widget.isVisible() attribute). Attributes marked as immutable do not have a 'setter' function. For example:

{
    widgetType: ui.widgetType.PushButton,
    text: "Show Alert",
    onClicked: function() {
        // displays an alert with the text of the button that was clicked
        alert("The button's text is: "; + this.text());
    },
}

From the context of a callback, a number of additional member functions are available for widgets:

For an in-depth example of writing your own widgets, see the EngineDesigner.js example in the Scripts folder of the FMOD Studio install directory.

ui.widgetType

An enumeration corresponding to different widget types available within a UI widget description. Possible values are:

ui.layoutType

An enumeration corresponding to different layout types available within a UI widget description of widgetType.Layout. Possible values are:

ui.alignment

An enumeration corresponding to the alignment of an item within a layout widget. Possible values are:

ui.sizePolicy

An enumeration corresponding to the size policy of a widget. This determines how much space it will try to consume within its layout, and how it will react when more or less space is made available.

Separate vertical and horizontal size policies will need to be specified. For example: sizePolicy: { horizontalPolicy: studio.ui.sizePolicy.Fixed, verticalPolicy: studio.ui.sizePolicy.Fixed }.

Please note that the size policy only applies to the individual widgets and not to the size of the dialog window.

Possible values are:

ui.orientation

An enumeration representing an orientation. Possible values are:

ui.echoMode

An enumeration corresponding to the echo mode of a LineEdit widget. This can be used to display asterisks instead of characters when entering a password. Possible values are:

ui.pathType

An enumeration corresponding to the different path types the PathLineEdit supports. This controls the behavior of browser dialog presented. Possible values are: