How to apply "Max Selected" to a check box listHi, Is it possible to apply the "Max Selected" filter to limit the number of Check Boxes that a User can select?
I will appreciate your suggestions.
Names Default To Here( 1 );
New Window( "Example",
cb = Check Box(
{"One", "Two", "Three"}, Max Selected(2),
Print(
"Selected: " ||
Concat Items( cb << Get Selected(), ", " )
)
)
);ScriptingRe: How to apply "Max Selected" to a check box listThere is not a Max Selected message that can be set, however one can write a script to do it. Here is my way of handling it
Names Default To Here( 1 );
New Window( "Example",
cb = Check Box(
{"One", "Two", "Three"},
curSelected = cb << get selected;
If( N Items( curSelected ) > 2,
// Determine the one just selected
For( i = 1, i <= N Items( cb << get items ), i++,
If(
Contains( curSelected, (cb << get items)[i] ) > 0 &
Contains( prevSelected, (cb << get items)[i] ) == 0,
dialog("Too many selections");
cb << set(i,0);
Break();
)
);
,
prevSelected = curSelected;
);
)
);Re: How to apply "Max Selected" to a check box listThanks @txnelson, I was afraid that the answer was going to be: No. Very nice your work-around, I will try to implement it in my code.