Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Panel

Superclass for UI widgets that contain multiple other UI widgets in a list. Doesn't have functionality by itself, use subclasses instead.

Hierarchy

Index

Methods

addChild

  • Add a child widget at the end

    Parameters

    • child: Widget

      The widget to add

    • Optional weight: number

      The amount of space the widget gets. 0 means as much as the widget requires, values above 0 give a weight compared to all other widgets with a weight above 0. Default: 0

    Returns Panel

getAllChildren

getChildAt

  • getChildAt(index: number): Widget | undefined
  • Return the child widget at the given index. Returns undefined if no child exists at the index.

    Parameters

    • index: number

      Index where to get the child widget

    Returns Widget | undefined

getHorizontalAlignment

  • getHorizontalAlignment(): number

getNumChildren

  • getNumChildren(): number
  • Return the number of child widgets

    Returns number

getOwningObject

getParent

  • getParent(): Widget | undefined
  • Return the widget that contains this widget, for example a border that wraps a check box. Returns undefined if this object has no parent.

    Returns Widget | undefined

getVerticalAlignment

  • getVerticalAlignment(): number

insertChild

  • insertChild(child: Widget, index: number, weight?: number): Panel
  • Insert a child widget at the given index. Inserts at the end if the index is not valid.

    Parameters

    • child: Widget

      The widget to insert

    • index: number

      Index at which to insert the new child

    • Optional weight: number

      The amount of space the widget gets. 0 means as much as the widget requires, values above 0 give a weight compared to all other widgets with a weight above 0. Default: 0

    Returns Panel

isEnabled

  • isEnabled(): boolean

isVisible

  • isVisible(): boolean

removeAllChildren

  • removeAllChildren(): void

removeChild

  • removeChild(child: Widget): void
  • Remove the given child widget

    Parameters

    • child: Widget

      The widget to remove

    Returns void

removeChildAt

  • removeChildAt(index: number): void
  • Remove the child widget at the given index

    Parameters

    • index: number

      Index where to remove the child widget

    Returns void

setChildDistance

  • setChildDistance(distance: number): Panel
  • Set distance (margin) between child widgets.

    Parameters

    • distance: number

      Widget distance. Default: 1

    Returns Panel

setEnabled

  • setEnabled(enabled: boolean): this
  • Set whether the widget is enabled. When a widget is disabled, users can't interact with it and it is greyed out. When a widget that contains other widgets (like VerticalBox) is disabled, all its children behave as if disabled, too. By default, widgets are enabled.

    Parameters

    • enabled: boolean

      Whether to enable the widget.

    Returns this

setEqualChildSize

  • setEqualChildSize(equal: boolean): Panel
  • deprecated

    This method doesn't do anything anymore except printing a warning. In order to control the size of the child widgets, use the weight parameter in addChild and insertChild. Setting the weight to 1 for all children has the same effect as setEqualChildSize(true) had. Setting the weight to 0 (default) has the same effect as setEqualChildSize(false), which was the default.

    Parameters

    • equal: boolean

    Returns Panel

setHorizontalAlignment

  • setHorizontalAlignment(alignment: number): Panel

setVerticalAlignment

  • setVerticalAlignment(alignment: number): Panel

setVisible

  • setVisible(visible: boolean): Widget
  • Set whether the widget is visible. When a widget that contains other widgets (like VerticalBox) is invisible, all its children are invisible, too. The layout of widgets is updated when visibility changes, and invisible widgets are treated as if they don't exist.

    Parameters

    • visible: boolean

      Whether the widget is visible.

    Returns Widget