Using the graphical user interface to build and exercise models. Includes customizing the GUI by writing a little bit of hoc.
Suranjana Gupta
Posts: 1
Joined: Fri Mar 14, 2014 3:33 am

I had a minor query. The default increment value for any parameter is typically 1 (in the GUI). Is it possible to change that to something else? And is it possible to restrict a certain parameter's value between 2 defined bounds (eg: 0 to 1) so that the parameter can never take a value greater than the upper bound?
ted
Posts: 5886
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Parameter adjustment with the spinner

Suranjana Gupta wrote:I had a minor query. The default increment value for any parameter is typically 1 (in the GUI). Is it possible to change that to something else?
Right click on a spinner (the widget with the "up and down arrow pair" that is just to the right of a numeric field), then select the increment size and modality (additive or multiplicative) from the popup menu.
is it possible to restrict a certain parameter's value between 2 defined bounds (eg: 0 to 1) so that the parameter can never take a value greater than the upper bound?
Use an xvalue statement that applies a function that enforces limits. Example: suppose you want a parameter called param to be limited to the range 0..10. Also, for the sake of this example suppose param's default value should be 5.

Code: Select all

``````MINparam = 0
MAXparam = 10
DEFparam = 5 // default value
// \$1 value to be tested
// \$2 minimum allowed value
// \$3 maximum allowed value
func limit() {
if (\$1<\$2) return \$2
if (\$1>\$3) return \$3
return \$1
}
param = DEFparam
xpanel("Enforce Parameter Limits")
xvalue("Parameter value","param", 1,"param = limit(param, MINparam, MAXparam)", 1, 1 )
xpanel(100, 150)``````