Search code examples
simulationanylogic

Simulation experiment screen - edit box "action" dynamic change on condition


I have two edit boxes on my simulation experiment screen prior to running the model, one box for a minimum value, and the other for a maximum value.

I want the value within the minimum edit box to be equal to the value within the maximum edit box if the user ever inputs a value that is higher than the latter.

Something like this :

mininum box = 10 maximum box = 15

User tries to do:

minimum box = 20

End result

minumum box = 15 maximum box = 15

I tried this below in the "action" properties of my Edit Box element, but it hasn't worked.

if(min > max){
     min = max;
     value = Integer.toString(max);
}

Thank you for your help


Solution

  • Write this in the min-box action code:

    if (value >= maxEditbox.getValue()) {
        minEditBox.setValue(maxEditbox.getValue());
    }