RSX Code Reference
    Preparing search index...

    Class MessageBox

    The MessageBox displays a message window containing a title, a message and a set of buttons. The class allows an easy and consistent way to query and inform the user. When the user click a button, an optional user callback is called and the window is closed.

    Hierarchy (View Summary)

    Index
    _buttonLayout: UIVerticalLayout

    The layout that holds the button elements.

    _contentVerticalLayout: UIVerticalLayout

    The main UI layout.

    _customElementLayout: UIVerticalLayout

    The layout that holds the custom element.

    _didClickButton: boolean
    _flexibleSpace: UIFlexibleSpace
    _icon: Image

    The displayed icon.

    _isRememberingChoice: boolean
    _mainVerticalLayout: UIVerticalLayout

    The main UI layout.

    _message: I18N

    The main message.

    _messageLabel: UILabel

    Label that displays the message.

    _secondaryMessage: I18N

    The secondary message.

    _secondaryMessageLabel: UILabel

    Label that displays the secondary message.

    _showRememberChoice: boolean

    Type of the dialog box.

    cancelButton: UIButton
    initialTitle: I18N

    The initial title of the message box.

    noButton: UIButton
    okButton: UIButton
    onResult: (
        result: EnumValue<DialogBoxResultType>,
        dialog: DialogBoxBase,
    ) => void

    Callback executed when the user pressed button, or enter/escape are pressed.

    retryButton: UIButton
    yesButton: UIButton
    defaultContentPadding: Immutable<RectOffset>

    The default window content padding to be used for modal windows.

    defaultWindowPadding: number

    The default window padding to be used for modal windows.

    kButtonSpacing: number
    kElementSpacing: number
    kIconSize: number
    • get contentHeight(): number

      Returns the height of the content area of the window, in points. The content area represents the area of the window not including the title bar and the border.

      Returns number

    • set contentHeight(value: number): void

      Parameters

      • value: number

      Returns void

    • get contentHeightInPixels(): number

      Returns the height of the content area of the window, in pixels. The content area represents the area of the window not including the title bar and the border.

      Returns number

    • set contentHeightInPixels(value: number): void

      Parameters

      • value: number

      Returns void

    • get contentWidth(): number

      Returns the width of the content area of the window, in points. The content area represents the area of the window not including the title bar and the border.

      Returns number

    • set contentWidth(value: number): void

      Parameters

      • value: number

      Returns void

    • get contentWidthInPixels(): number

      Returns the width of the content area of the window, in pixels. The content area represents the area of the window not including the title bar and the border.

      Returns number

    • set contentWidthInPixels(value: number): void

      Parameters

      • value: number

      Returns void

    • get dpiScale(): number

      Returns the DPI scale factor.

      Returns number

      The DPI scale is in relation to a 1x base resolution of 75 DPI.

    • get height(): number

      Sets the height of the window in points.

      Returns number

    • set height(value: number): void

      Parameters

      • value: number

      Returns void

    • get heightInPixels(): number

      Sets the height of the window in pixels.

      Returns number

    • set heightInPixels(value: number): void

      Parameters

      • value: number

      Returns void

    • get isDestroyed(): boolean

      Check whether the window was destroyed.

      Returns boolean

    • get isFocused(): boolean

      Checks whether the window currently has keyboard focus.

      Returns boolean

    • set isFocused(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get keyWindow(): KeyWindowBase

      Gets the key window which owns this window.

      Returns KeyWindowBase

    • get left(): number

      Returns the X position of the window in screen coordinates in points.

      Returns number

    • get localShortcutContext(): ShortcutContext

      Specifies the local shortcut context. This context will be automatically disabled whenever the user switches focus from the context.

      Returns ShortcutContext

    • get renderWindow(): RenderWindow

      Gets the RenderWindow associated with this EditorWindow.

      Returns RenderWindow

    • get shortcutContext(): ShortcutContext

      Specifies the global shortcut context. This context will be always enabled as long as the window is active.

      Returns ShortcutContext

    • get showRememberChoice(): boolean

      Shows the remember my choice option to the user.

      Returns boolean

      This feature is not compatible with custom elements that can be added to a message box using setCustomElement. If a custom element is set, it will be removed.

    • set showRememberChoice(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get styleSheet(): StyleSheet

      Sets the stylesheet for this window's UI surface.

      Returns StyleSheet

    • set styleSheet(value: StyleSheet): void

      Sets the stylesheet for this window's UI surface.

      Parameters

      Returns void

    • set title(value: I18N): void

      Changes the text in the modal window title bar.

      Parameters

      Returns void

    • get top(): number

      Returns the X position of the window in screen coordinates in points.

      Returns number

    • get width(): number

      Sets the width of the window in points.

      Returns number

    • set width(value: number): void

      Parameters

      • value: number

      Returns void

    • get widthInPixels(): number

      Sets the width of the window in pixels.

      Returns number

    • set widthInPixels(value: number): void

      Parameters

      • value: number

      Returns void

    • Shortcut triggered when Escape is pressed.

      Returns void

    • Centers the window within it's parent window.

      Returns void

    • Closes and destroys the window.

      Returns void

    • Shortcut triggered when enter is pressed.

      Returns void

    • Virtual

      Called whenever the user or the program requested to close the window.

      Returns void

    • Virtual

      Method to override to implement destruction of custom windows. Called by the engine before the window is destroyed.

      Returns void

    • Virtual

      Method to override to implement custom behavior of a window, called by the engine once per frame.

      Returns void

    • Virtual

      Method to override to implement custom behavior of a window, called by the engine once per frame, once all the windows had their onEditorUpdate() method called.

      Returns void

    • Virtual

      Called whenever window visibility changed.

      Parameters

      • isVisible: boolean

      Returns void

      Implementing classes must call super.

    • Virtual

      Triggered whenever the window gains or loses focus.

      Parameters

      • inFocus: boolean

        True if focus was gained, false otherwise.

      Returns void

    • Virtual

      Triggered whenever the window size changes.

      Parameters

      • width: number

        New width of the window in pixels.

      • height: number

        New height of the window in pixels.

      Returns void

    • Virtual

      Adds a custom element to the message box.

      Parameters

      • element: UIElementBase

        The element to add to the message box.

      • OptionaloverflowScroll: boolean

        If set, the element will be added to a scroll area if the height overflows The maximum height of the dialog box.

      Returns void

      To remove the custom element, call this method again and pass null

    • Defines the window maximum width and height in points.

      Parameters

      • maxWidth: number
      • maxHeight: number

      Returns void

    • Defines the window minimum width and height in points.

      Parameters

      • minWidth: number

        The minimum width of the window in points.

      • minHeight: number

        The minimum height of the window in points.

      Returns void

    • Moves the window on the desktop. Coordinates are in screen space using points.

      Parameters

      • x: number
      • y: number

      Returns void

    • Moves the window on the desktop. Coordinates are in screen space using pixels.

      Parameters

      • x: number
      • y: number

      Returns void

    • Resizes the window using a width and height in points.

      Parameters

      • width: number
      • height: number

      Returns void

    • Resizes the window using a width and height in pixels.

      Parameters

      • width: number
      • height: number

      Returns void

    • Creates a lambda functor that shows a message box when called. Depending on the user action the onConfirm or optionally, the onCancel lambdas will be invoked.

      Parameters

      • parentWindow: KeyWindowBase | EditorWindow
      • title: I18N

        Text to display in the title bar.

      • message: I18N

        Message to display in the dialog box.

      • secondaryMessage: I18N

        Secondary message to display in regular text.

      • onConfirm: () => void

        Callback to trigger when the user clicks the 'Yes' button.

      • OptionalonCancel: () => void

        Optional. Callback to trigger when the user clicks the 'No' button.

      • OptionalonShow: () => EnumValue<DialogBoxResultType, number>

        Optional. Will be invoked when the message box is showned. If the value is set and doesn't return null. The return value will be used to call either onConfirm or onCancel.

      • Optionalicon: Image

      Returns () => void

      a lambda functor that shows a message box when called

      This is a convenience API to be used to handle user-action on button presses or other UI elements. The use of this function is as in the following code example:

         this.onDeleteButton.add(makeConfirmLambda("Item deletion",
      "Do you really want to delete the item?",
      "It will be lost forever.", () => this.deleteItem(value)));
    • Opens a new message box with custom button labels.

      Parameters

      • parentWindow: KeyWindowBase | EditorWindow

        A reference to the parent window that is opening this dialog box. If null will assume the active window.

      • title: I18N

        Text to display in the title bar.

      • message: I18N

        Message to display in the dialog box.

      • secondaryMessage: I18N

        Secondary message to display in regular text.

      • buttons: [I18N] | [I18N, I18N] | [I18N, I18N, I18N]

        An array of 1, 2 or 3 i18n strings.

      • OptionalonResult: (result: EnumValue<DialogBoxResultType>, messageBox: MessageBox) => void

        Callback to trigger when the user clicks on a dialog box button.

      • Optionalicon: Image

        Optional icon to display on the left side of the dialog.

      • OptionalrememberUserChoice: boolean

      Returns MessageBox

      Instance of the dialog box window.

    • Opens a new message box with predefined button labels.

      Parameters

      • parentWindow: KeyWindowBase | EditorWindow

        A reference to the parent window that is opening this dialog box. If null will assume the active window.

      • title: I18N

        Text to display in the title bar.

      • message: I18N

        Message to display in the dialog box.

      • secondaryMessage: I18N

        Secondary message to display in regular text.

      • type: EnumValue<DialogBoxType>

        Type of dialog box that determines what buttons to display.

      • OptionalonResult: (result: EnumValue<DialogBoxResultType>, messageBox: MessageBox) => void

        Callback to trigger when the user clicks on a dialog box button.

      • Optionalicon: Image

        Optional icon to display on the left side of the dialog.

      • OptionalrememberUserChoice: boolean

      Returns MessageBox

      Instance of the dialog box window.

    • Create a message box to confirm an action.

      Parameters

      • parentWindow: KeyWindowBase | EditorWindow
      • title: I18N

        Text to display in the title bar.

      • message: I18N

        Message to display in the dialog box.

      • secondaryMessage: I18N

        Secondary message to display in regular text.

      • onConfirm: () => void

        Callback to trigger when the user clicks the 'Yes' button.

      • OptionalonCancel: () => void

        Optional. Callback to trigger when the user clicks the 'No' button.

      • OptionalonShow: () => EnumValue<DialogBoxResultType, number>

        Optional. Will be invoked when the message box is showned. If the value is set and doesn't return null. The return value will be used to call either onConfirm or onCancel.

      • Optionalicon: Image

      Returns void

      a lambda functor that shows a message box when called

    onResized: Event<[p0: number, p1: number]>

    Triggered whenever window size changes.

    onFocusChangedInternal: Event<[isFocused: boolean]>