How to put dynamic constraints on controls allowed values in NetLogo

136 Views Asked by At

Let's say for example that I want the user to be able to create a network with a certain number of nodes and edges. I use a slider for the number of nodes and edges, but if for instance the user chooses 10 as number of nodes, then the maximum value of the edges sliders should be 45. Or an alternative could be to use an input and to show an error message if the user types an incorrect values. How can I achieve this?

1

There are 1 best solutions below

1
On BEST ANSWER

Let's say you have a slider called nodes where user can set the number of nodes in the network, you can add a second slider called edges whose maximum value depends on actual value on nodes slider as in the picture:

edges slider

This is possible since the slider represents a global variable accessible in every moment by the observer.