mirror of https://github.com/axmolengine/axmol.git
Change not to dispatch event when add radio buttons
This commit is contained in:
parent
db182b2e50
commit
da85b16292
|
@ -194,7 +194,7 @@ void RadioButtonGroup::addRadioButton(RadioButton* radioButton)
|
|||
|
||||
if(!_allowedNoSelection && _selectedRadioButton == nullptr)
|
||||
{
|
||||
setSelectedButton(radioButton);
|
||||
setSelectedButtonWithoutEventCallback(radioButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ void RadioButtonGroup::removeRadioButton(RadioButton* radioButton)
|
|||
|
||||
if(!_allowedNoSelection && _selectedRadioButton == nullptr && !_radioButtons.empty())
|
||||
{
|
||||
setSelectedButton(0);
|
||||
setSelectedButtonWithoutEventCallback(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -261,6 +261,12 @@ void RadioButtonGroup::setSelectedButton(int index)
|
|||
}
|
||||
|
||||
void RadioButtonGroup::setSelectedButton(RadioButton* radioButton)
|
||||
{
|
||||
setSelectedButtonWithoutEventCallback(radioButton);
|
||||
onChangedRadioButtonSelect(_selectedRadioButton);
|
||||
}
|
||||
|
||||
void RadioButtonGroup::setSelectedButtonWithoutEventCallback(RadioButton* radioButton)
|
||||
{
|
||||
if(!_allowedNoSelection && radioButton == nullptr)
|
||||
{
|
||||
|
@ -282,7 +288,6 @@ void RadioButtonGroup::setSelectedButton(RadioButton* radioButton)
|
|||
{
|
||||
_selectedRadioButton->setSelected(true);
|
||||
}
|
||||
onChangedRadioButtonSelect(_selectedRadioButton);
|
||||
}
|
||||
|
||||
std::string RadioButtonGroup::getDescription() const
|
||||
|
|
|
@ -258,6 +258,7 @@ protected:
|
|||
|
||||
void onChangedRadioButtonSelect(RadioButton* radioButton);
|
||||
void deselect();
|
||||
void setSelectedButtonWithoutEventCallback(RadioButton* radioButton);
|
||||
|
||||
Vector<RadioButton*> _radioButtons;
|
||||
ccRadioButtonGroupCallback _radioButtonGroupEventCallback;
|
||||
|
|
Loading…
Reference in New Issue