Since very long, I have been controlling widget values through the Command Center.
This is especially useful for finding the exact parameter value where a regime shift occurs.
Last week I encountered a problem related to it. And I wanted to find out what NetLogo was supposed to do.
Where in the documentation (User Manual or elsewhere) can I find information about changing the values of input widgets (Sliders, Switches, Choosers, Input boxes) from code?
Particularly, what are correct values, and what does NetLogo do when the value assigned is incorrect?
I don’t think there is any explicit documentation regarding the behavior when changing widget values from the Command Center, and the intended behavior is not consistent between widget types. Could you be more specific about the exact issue you ran into? We fixed a couple bugs related to this issue for the upcoming release, NetLogo 7.0.3, so we might have already fixed your problem.
For the issue that I ran into, the solution is on its way.
The more general question is what happens if the value assigned is of the wrong type, particularly for Input boxes, or when the value is outside range (Sliders, in some way Choosers).
I found the following phrase in the release notes of version 4.0:
code may now set a slider to values which violate the minimum, maximum, or increment
As far as I could find, this is not documented anywhere else.
Sliders are supposed to be able to take any number, when set through code. Other than that, when you try to set a widget’s global variable to things that would typically be thought of as “outside the widget’s range”, NetLogo will generate a runtime error to tell you that the value is not appropriate for that variable.