ChoiceBox

A ChoiceBox, has a list of items (of type V), one of which can be selected. (selection is a SingleSelectionModel).

When the ChoiceBox is pressed a PopupMenu appears, which contains all items as ToggleMenuItems. The selected item will have a tick-mark.

The text within the ChoiceBox and the ToggleMenuItems are generated from items using the converter. The default behaviour simply uses .toString(), unless the selected item is null, in which case nullString is used (which defaults to "").

Theme DSL

"choice_box" {

    "nullString"( String ) // What to display for `null` items. Defaults to ""

    child( "button" ) {
        ... // The default theme places a `down` arrow graphic on the right hand side.
    }
}

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val children: ObservableList<Button>

The base class Node has no children, so this is an empty list.

Link copied to clipboard
var converter: (V?) -> String
Link copied to clipboard
open override var disabled: Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The string returned by the default converter for null items. At present Glok has no I18N, and this is the English text "". Do not rely on "" being the default value, because a future version of Glok may provide translations based on the user's language preference.

Link copied to clipboard
Link copied to clipboard
var value: V?
Link copied to clipboard
Link copied to clipboard

The text displayed in the ChoiceBox. This uses converter, not toString().

Link copied to clipboard

A Property whose value is of type V? (i.e. its value may be null).

Functions

Link copied to clipboard
open override fun nodePrefHeight(): Float

Each subclass of node can determine its preferred height. As most nodes are composed of smaller nodes, this is typically calculated using evalPrefWidth of the child nodes, with extra added for spacing, padding and borders.

Link copied to clipboard
open override fun nodePrefWidth(): Float

Each subclass of node can determine its preferred width. As most nodes are composed of smaller nodes, this is typically calculated using evalPrefWidth of the child nodes, with extra added for spacing, padding and borders.

Link copied to clipboard
open override fun toString(): String