Nez.Portable/UI/Widgets/ButtonGroup.cs
/// <summary>
/// Called when a button is checked or unchecked. If overridden, generally changing button checked states should not be done
/// from within this method.
/// </summary>
/// <returns>True if the new state should be allowed</returns>
/// <param name="button">Button.</param>
/// <param name="newState">New state.</param>
Called when a button is checked or unchecked. If overridden, generally changing button checked states should not be done
from within this method.
Called when a button is checked or unchecked . If overridden generally changing button checked states should not be done from within this method .
public bool canCheck(Button button, bool newState)
        {
            if (button.isChecked == newState)
                return false;
            if (!newState)
            {
                if (checkedButtons.Count <= minCheckCount)
                    return false;
                checkedButtons.Remove(button);
            }
            else
            {
                if (maxCheckCount != -1 && checkedButtons.Count >= maxCheckCount)
                {
                    if (uncheckLast)
                    {
                        int old = minCheckCount;
                        minCheckCount = 0;
                        lastChecked.isChecked = false;
                        minCheckCount = old;
                    }
                    else
                        return false;
                }
                checkedButtons.Add(button);
                lastChecked = button;
            }
            return true;
        }
public bool canCheck ( Button button , bool newState ) { if ( button . isChecked == newState ) return false ; if ( ! newState ) { if ( checkedButtons . Count <= minCheckCount ) return false ; checkedButtons . Remove ( button ) ; } else { if ( maxCheckCount != - 1 && checkedButtons . Count >= maxCheckCount ) { if ( uncheckLast ) { int old = minCheckCount ; minCheckCount = 0 ; lastChecked . isChecked = false ; minCheckCount = old ; } else return false ; } checkedButtons . Add ( button ) ; lastChecked = button ; } return true ; }
Called when a button is checked or unchecked.
Called when a button is checked or unchecked .
// Keep button checked to enforce minCheckCount. // Keep button unchecked to enforce maxCheckCount.
True if the new state should be allowed
True if the new state should be allowed
button
Button
None
newState
bool
None