Skip to content

Intro to Multiple Option Widgets

A multiple option widget handles an array of different options and lets the user select one. However, there are many ways to actually render this, and gooey provides three implementations: a multiple option group, a drop down / "combo box" and a spinner.

But first, let's talk about the basics of any multiple option widget.

Setting up the options

All multiple option widgets rely on an array of strings. This can be set through the constructor, and later modified using setOptionArraySelected (for the currently selected item), setOptionArrayUnselected (for items not selected) and setOptionArrayMouseover (when hovering over an item).

The currently selected option is stored in the index, and corresponds to the index of the array. The index initially defaults to -1 (no option selected) but can be configured from the constructor.

You can select a particular option programatically by using setIndex.

Multiple selections

At this time, gooey does not support widgets for selecting more than one item.

Rendering the options

You can alter the formatting of the strings using ScribbleDX tags. One can set up formatting for the selected item using setTextFormatSelected, for the rest of the items using setTextFormatUnselected and a special formatting when the user hovers over an item, through setTextFormatMouseover.

Other than that, each multiple option widget has specific formatting methods to choose the relevant sprites and images, set spacing, etc.