Skip to content
Nicolas Payette edited this page Jun 25, 2020 · 33 revisions

Those are the widget kinds that are bundled with the extension:

Tab, Button, Checkbox, Chooser, Multi-Chooser, Note, Numeric Input, Slider, Text-Input.

(Other kinds could also be added.)


Tab

Tab

A tab is a container for the widgets provided by the extension. Each you create a new widget, it is placed on the most recently created tab. Or can explicitly set the widget's tab property with xw:set-tab.

A tab is not a widget per se (and not included in the list reported by xw:widgets), but it is mostly manipulated in the same way.

Extra tabs created by the extension are inserted between NetLogo's main Interface tab and the Info tab. You can change the order of the extra tabs relative to one another by setting their order property.

Create List Default Property
xw:create-tab xw:tabs None
Property Getter Setter Type Default
Color xw:color xw:set-color Color white
Enabled? xw:enabled? xw:set-enabled? Boolean true
Key xw:key None String n/a
Kind xw:kind None String "TAB"
Order xw:order xw:set-order Number 0
Title xw:title xw:set-title String ""

Button

Button

A button runs the string contained in its Commands property when clicked.

Create List Default Property
xw:create-button xw:buttons None
Property Getter Setter Type Default
Color xw:color xw:set-color Color [188 188 230 255]
Commands xw:commands xw:commands String ""
Enabled? xw:enabled? xw:set-enabled? Boolean true
Font color xw:font-color xw:set-font-color Color black
Font size xw:font-size xw:set-font-size Number 12
Height xw:height xw:set-height Number 25
Hidden? xw:hidden? xw:hidden? Boolean false
Key xw:key None String n/a
Kind xw:kind None String "BUTTON"
Label xw:label xw:set-label String ""
Tab xw:tab xw:set-tab String Last created tab
Width xw:width xw:set-width Number 150
X xw:x xw:set-x Number 10
Y xw:y xw:set-y Number 10

Checkbox

Checkbox

A checkbox allows the user to choose if something should be true or false. It serves the same function as a regular NetLogo switch widget.

The Selected? property contains the current choice.

Create List Default Property
xw:create-checkbox xw:checkboxes Selected?
Property Getter Setter Type Default
Color xw:color xw:set-color Color [130 188 183 255]
Enabled? xw:enabled? xw:set-enabled? Boolean true
Font color xw:font-color xw:set-font-color Color black
Font size xw:font-size xw:set-font-size Number 12
Height xw:height xw:set-height Number 25
Hidden? xw:hidden? xw:hidden? Boolean false
Key xw:key None String n/a
Kind xw:kind None String "CHECKBOX"
Label xw:label xw:set-label String ""
Opaque? xw:opaque? xw:set-opaque? Boolean true
Selected? xw:selected? xw:set-selected? Boolean false
Tab xw:tab xw:set-tab String Last created tab
Width xw:width xw:set-width Number 150
X xw:x xw:set-x Number 10
Y xw:y xw:set-y Number 10

Chooser

Chooser

A chooser allows the user to choose one value out of a list.

The available values are defined through the Items property. They are provided as a list and can be of any valid NetLogo type. (Caveat: some types don't work with xw:export.)

The Selected Item property contains the current choice.

Create List Default Property
xw:create-chooser xw:choosers Selected Item
Property Getter Setter Type Default
Color xw:color xw:set-color Color [130 188 183 255]
Enabled? xw:enabled? xw:set-enabled? Boolean true
Font color xw:font-color xw:set-font-color Color black
Font size xw:font-size xw:set-font-size Number 12
Height xw:height xw:set-height Number 50
Hidden? xw:hidden? xw:hidden? Boolean false
Items xw:items xw:set-items List []
Key xw:key None String n/a
Kind xw:kind None String "CHOOSER"
Label xw:label xw:set-label String ""
Opaque? xw:opaque? xw:set-opaque? Boolean true
Selected Item xw:selected-item xw:set-selected-item Any nobody
Tab xw:tab xw:set-tab String Last created tab
Width xw:width xw:set-width Number 150
X xw:x xw:set-x Number 10
Y xw:y xw:set-y Number 10

Multi-Chooser

Multi-Chooser

A multi-chooser allows the user to choose many values out of a list.

(This is normally done by holding the Ctrl key while clicking on the items.)

The available values are defined through the Items property. They are provided as a list and can be of any valid NetLogo type. (Caveat: some types don't work with xw:export.)

The Selected Items property contains a list of the current choices.

Create List Default Property
xw:create-multi-chooser xw:multi-choosers Selected Items
Property Getter Setter Type Default
Color xw:color xw:set-color Color [130 188 183 255]
Enabled? xw:enabled? xw:set-enabled? Boolean true
Font color xw:font-color xw:set-font-color Color black
Font size xw:font-size xw:set-font-size Number 12
Height xw:height xw:set-height Number 100
Hidden? xw:hidden? xw:hidden? Boolean false
Items xw:items xw:set-items List []
Key xw:key None String n/a
Kind xw:kind None String "MULTI-CHOOSER"
Label xw:label xw:set-label String ""
Opaque? xw:opaque? xw:set-opaque? Boolean true
Selected Items xw:selected-items xw:set-selected-items List []
Tab xw:tab xw:set-tab String Last created tab
Width xw:width xw:set-width Number 150
X xw:x xw:set-x Number 10
Y xw:y xw:set-y Number 10

Note

Note

A note is just text displayed on the screen; the user cannot interact with it.

It is the only extra widget that is not opaque by default, but you can make it opaque and change its background color if you want to.

Create List Default Property
xw:create-note xw:notes Text
Property Getter Setter Type Default
Color xw:color xw:set-color Color white
Enabled? xw:enabled? xw:set-enabled? Boolean true
Font color xw:font-color xw:set-font-color Color black
Font size xw:font-size xw:set-font-size Number 12
Height xw:height xw:set-height Number 25
Hidden? xw:hidden? xw:hidden? Boolean false
Key xw:key None String n/a
Kind xw:kind None String "NOTE"
Opaque? xw:opaque? xw:set-opaque? Boolean false
Tab xw:tab xw:set-tab String Last created tab
Text xw:text xw:set-text String ""
Width xw:width xw:set-width Number 150
X xw:x xw:set-x Number 10
Y xw:y xw:set-y Number 10

Numeric Input

Numeric Input

A numeric input box allows the user to enter a number only.

If a user tries to enter anything but a valid number, they will get an error.

This number is contained in the Value property.

Create List Default Property
xw:create-numeric-input xw:numeric-inputs Value
Property Getter Setter Type Default
Color xw:color xw:set-color Color [130 188 183 255]
Enabled? xw:enabled? xw:set-enabled? Boolean true
Font color xw:font-color xw:set-font-color Color black
Font size xw:font-size xw:set-font-size Number 12
Height xw:height xw:set-height Number 50
Hidden? xw:hidden? xw:hidden? Boolean false
Key xw:key None String n/a
Kind xw:kind None String "NUMERIC-INPUT"
Label xw:label xw:set-label String ""
Opaque? xw:opaque? xw:set-opaque? Boolean true
Tab xw:tab xw:set-tab String Last created tab
Value xw:value xw:set-value Number 0
Width xw:width xw:set-width Number 150
X xw:x xw:set-x Number 10
Y xw:y xw:set-y Number 10

Slider

Slider

A slider allows the user to select a numeric value by moving the slider back and forth.

This number is contained in the Value property.

The range of values selectable by the user is constrained by the Minimum, Maximum and Increment properties. Note, however, that values you set through code with xw:set-value are not bound by these constraints.

The Units property allows you to display a label besides the selected number (e.g., "%", "degrees", etc.)

Create List Default Property
xw:create-slider xw:sliders Value
Property Getter Setter Type Default
Color xw:color xw:set-color Color [130 188 183 255]
Enabled? xw:enabled? xw:set-enabled? Boolean true
Font color xw:font-color xw:set-font-color Color black
Font size xw:font-size xw:set-font-size Number 12
Height xw:height xw:set-height Number 50
Hidden? xw:hidden? xw:hidden? Boolean false
Increment xw:increment xw:set-increment Number 1
Key xw:key None String n/a
Kind xw:kind None String "SLIDER"
Label xw:label xw:set-label String ""
Maximum xw:maximum xw:set-maximum Number 0
Minimum xw:minimum xw:set-minimum Number 0
Opaque? xw:opaque? xw:set-opaque? Boolean true
Tab xw:tab xw:set-tab String Last created tab
Units xw:units xw:set-units String ""
Value xw:value xw:set-value Number 50
Width xw:width xw:set-width Number 150
X xw:x xw:set-x Number 10
Y xw:y xw:set-y Number 10

Text Input

Text input

A text input box allows the user to enter any text that they want.

This text is contained in the Text property.

Create List Default Property
xw:create-text-input xw:text-inputs Text
Property Getter Setter Type Default
Color xw:color xw:set-color Color [130 188 183 255]
Enabled? xw:enabled? xw:set-enabled? Boolean true
Font color xw:font-color xw:set-font-color Color black
Font size xw:font-size xw:set-font-size Number 12
Height xw:height xw:set-height Number 50
Hidden? xw:hidden? xw:hidden? Boolean false
Key xw:key None String n/a
Kind xw:kind None String "TEXT-INPUT"
Label xw:label xw:set-label String ""
Opaque? xw:opaque? xw:set-opaque? Boolean true
Tab xw:tab xw:set-tab String Last created tab
Text xw:text xw:set-text String ""
Width xw:width xw:set-width Number 150
X xw:x xw:set-x Number 10
Y xw:y xw:set-y Number 10