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 listAll you need to do for such items as your "Max Selected" message you suggested, is to go to the Scripting Index and look at the CheckBox entry. And if you don't see a message that will do what you are suggesting, then there isn't such a capability directly from the object
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.
Re: 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;
);
)
);