-
Notifications
You must be signed in to change notification settings - Fork 4
Properties
Color, Commands, Enabled?, Font-color, Font-size, Height, Hidden?, Increment, Items, Key, Kind, Label, Maximum, Minimum, Opaque?, Order, Selected-item, Selected-items, Selected?, Tab, Text, Title, Units, Value, Width, X, Y
The background color of the widget.
For widgets with the Opaque? property, xw:opaque?
need to be true
for the background color to be apparent.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:color |
xw:set-color |
Color | Tab, Button, Checkbox, Chooser, Multi-Chooser, Note, Numeric Input, Slider, Text-Input. |
The commands to be run when a button is clicked.
Those commands are provided as a string that is not pre-compiled: if there are errors in the command, you will only find out at runtime. (This is similar to using run
with a string).
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:commands |
xw:set-commands |
String | Button. |
A widget that is enabled allows user to change the value(s) entered in the widget. A widget that is disabled... doesn't. A disabled widget still appears on the screen, but it is grayed out and cannot be changed until it is enabled again.
For a Note, with which no user interaction is possible anyway, disabling it only makes it appear grayed out.
Note that calling xw:set-enabled? false
on a Tab will make all the widgets on that tab appear disabled without affecting their Enabled? property. This way, if you later re-enable the tab, you will get the same mixture of enabled/disabled widgets that you had before disabling the tab. If you do want to individually disable all the widgets on a tab, you can do:
xw:ask xw:widgets xw:with [ xw:tab = "my-tab" ] [
xw:set-enabled? false
]
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:enabled? |
xw:set-enabled? |
Boolean | Tab, Button, Checkbox, Chooser, Multi-Chooser, Note, Numeric Input, Slider, Text-Input. |
The color of the font for text displayed on the widgets.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:font-color |
xw:set-font-color |
Color | Button, Checkbox, Chooser, Multi-Chooser, Note, Numeric Input, Slider, Text-Input. |
The size of the font for text displayed on the widgets.
The font size cannot be smaller than 1.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:font-size |
xw:set-font-size |
Number | Button, Checkbox, Chooser, Multi-Chooser, Note, Numeric Input, Slider, Text-Input. |
The height of a widget, in pixels.
A common use of this property is [ xw:height + xw:y ] xw:of "widget"
, which gives you the bottom coordinate of a widget, which you can use to position another widget under it.
Setting the width to a negative number is currently allowed by the extension, but it will make your widget disappear.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:height |
xw:set-height |
Number | Button, Checkbox, Chooser, Multi-Chooser, Note, Numeric Input, Slider, Text-Input. |
Whether a widget is hidden or not.
A hidden widget is not visible to the user, but its properties can still be manipulated through code.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:hidden? |
xw:set-hidden? |
Boolean | Button, Checkbox, Chooser, Multi-Chooser, Note, Numeric Input, Slider, Text-Input. |
The number by which the value of a Slider is changed when a user moves it.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:increment |
xw:set-increment |
Number | Slider. |
The list of items available to select in a Chooser or Multi-Chooser.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:items |
xw:set-items |
List | Chooser, Multi-Chooser. |
The string by which a widget or tab is uniquely identified.
You need to provide a key when you create a widget through xw:create-<kind>, but also when you want to manipulate one (or many) widgets with xw:ask
, xw:get
, xw:of
, xw:remove
, xw:set
and xw:with
. The xw:widgets
and xw:<kinds> primitives report list of keys.
This property is read-only.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:key |
None | String | Tab, Button, Checkbox, Chooser, Multi-Chooser, Note, Numeric Input, Slider, Text-Input. |
A string description of the kind of a widget or tab.
A common use case is excluding some kinds of widgets from an operation. For example:
foreach xw:widgets xw:with [ not member? xw:kind ["NOTE" "BUTTON"] ] [
print xw:get ?
]
This property is read-only.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:kind |
None | String | Tab, Button, Checkbox, Chooser, Multi-Chooser, Note, Numeric Input, Slider, Text-Input. |
A string that serves as a label for the widget.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:label |
xw:set-label |
String | Button, Checkbox, Chooser, Multi-Chooser, Numeric Input, Slider, Text-Input. |
The maximum number that a user can select in a slider.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:maximum |
xw:set-maximum |
Number | Slider. |
The minimum number that a user can select in a slider.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:minimum |
xw:set-minimum |
Number | Slider. |
Whether or not a widget has a colored background and a border.
(Note that the background of an "opaque" widget can still be made transparent by setting it to a transparent color, e.g.: xw:set-color [0 0 0 0]
.)
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:opaque? |
xw:set-opaque? |
Boolean | Checkbox, Chooser, Multi-Chooser, Note, Numeric Input, Slider, Text-Input. |
The order in which an extra tab appears relative to other extra tabs.
This property that can be set to any valid NetLogo number. Tabs will lower xw:order
will appear before (i.e., to the left of) tabs with higher numbers. If two tabs have the same xw:order
(as will usually be the case since all tabs have order 0
by default), they appear in order of creation.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:order |
xw:set-order |
Number | Tab. |
The item that is currently selected in a chooser. If no item is selected (i.e., if the list of available items is empty), it contains nobody
.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:selected-item |
xw:set-selected-item |
Any | Chooser. |
The list of items that are currently selected in a multi-chooser. It contains an empty list of no items are currently selected.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:selected-items |
xw:set-selected-items |
List | Multi-Chooser. |
Whether or not a checkbox is currently selected.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:selected? |
xw:set-selected? |
Boolean | Checkbox. |
The key of the tab on which the widget currently is.
By setting the value of this property, you can move a widget from one tab to another.
If you want to create a widget on a tab other than the last tab added, it is necessary to manually set the tab using xw:set-tab
.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:tab |
xw:set-tab |
String | Button, Checkbox, Chooser, Multi-Chooser, Note, Numeric Input, Slider, Text-Input. |
The text of a note or text input widget.
In the case of a text input widget, the text can be modified by the user.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:text |
xw:set-text |
String | Note, Text-Input. |
The title of a tab.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:title |
xw:set-title |
String | Tab. |
The string that appears after the value on a slider widget.
It is often used for things like "%"
, "$"
, "km"
, etc., but it can be any string, as long as you want (though a long string may not fit in your slider).
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:units |
xw:set-units |
Number | Slider. |
The current numeric value of a slider or numeric input box.
In both cases, the value can be modified by the user interacting with the widget.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:value |
xw:set-value |
Number | Numeric Input, Slider. |
The width of a widget, in pixels.
A common use of this property is [ xw:width + xw:y ] xw:of "widget"
, which gives you the right coordinate of a widget, which you can use to position another widget beside it.
Setting the width to a negative number is currently allowed by the extension, but it will make your widget disappear.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:width |
xw:set-width |
Number | Button, Checkbox, Chooser, Multi-Chooser, Note, Numeric Input, Slider, Text-Input. |
The x (i.e., horizontal) coordinate of the widget on the screen.
Coordinate (0, 0) is the top left corner of the screen.
You can set the x coordinate of a widget to a negative number, but it will make your widget disappear, partially or completely.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:x |
xw:set-x |
Number | Button, Checkbox, Chooser, Multi-Chooser, Note, Numeric Input, Slider, Text-Input. |
The y (i.e., vertical) coordinate of the widget on the screen.
Coordinate (0, 0) is the top left corner of the screen.
You can set the y coordinate of a widget to a negative number, but it will make your widget disappear, partially or completely.
Getter | Setter | Type | Applies To |
---|---|---|---|
xw:y |
xw:set-y |
Number | Button, Checkbox, Chooser, Multi-Chooser, Note, Numeric Input, Slider, Text-Input. |