All,
I am trying to create a control panel for a sporting event where it has a bunch of parameter dropdowns that you can use to put a show in order according to a script. My question is is there a way that I can create a variable or something similar to produce the “Choices” since there will be around 50 or more drop downs all with the same choices. and those may change as the season goes on.
Appreciate the help.
Hi Casey,
Below is the source for a panel which should provide a working example for what you are trying to implement.
The “params.array” is a string array which can be manipulated using the table. When the “Go!” button is clicked, the values of this string array are passed as an argument to create a integer choice constraint. This constraint along with an OID is then passed to “params.replaceConstraint” to set the new constraint.
params.array
a
b
a
b
params.setValue('params.table', 0, this.getValue());
var newValues = params.getAllValues('params.array');
var constraint = params.createIntChoiceConstraint(newValues);
params.replaceConstraint(‘params.combo’, constraint);
var elementCount = params.getElementCount(‘params.array’);
params.setValue(‘params.array’, elementCount, ‘’);
params.setValue(‘params.table’, 0, elementCount);
var selection = params.getValue(‘params.table’, 0);
var elemCount = params.getElementCount(‘params.array’);
if (selection >= 0 && selection < elemCount && elemCount > 1)
{
params.getParam(‘params.array’, selection).remove();
}
else if (elemCount == 1)
{
params.setValue(‘params.array’, 0, ‘’);
}
elemCount = params.getElementCount(‘params.array’);
if (selection >= elemCount)
{
params.setValue(‘params.table’, 0, params.getElementCount(‘params.array’) - 1);
}
Please let me know if you have any questions.