private int MutuallyExclusiveChoice( object _Sender, CheckBox[] _Choices )
{
m_ModifyingCheckboxes = true;
CheckBox C = _Sender as CheckBox;
if ( !C.Checked )
{ // User unchecked the only possible choice so we know that this tag is empty
m_ModifyingCheckboxes = false;
return 0;
}
// Uncheck all others and keep the only one that's checked
int SelectedChoice = 0;
for ( int ChoiceIndex=0; ChoiceIndex < _Choices.Length; ChoiceIndex++ )
if ( _Choices[ChoiceIndex] == C )
SelectedChoice = ChoiceIndex;
else
_Choices[ChoiceIndex].Checked = false;
m_ModifyingCheckboxes = false;
return 1+SelectedChoice; // 1+ because choice 0 is NONE
}