Skip to content

Commit

Permalink
修复TabBox在XML中设置selectedid无效的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
smallevilbeast committed Jun 27, 2019
1 parent fed1569 commit f8cd48c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tool_kits/duilib/Box/TabBox.cpp
Expand Up @@ -16,8 +16,10 @@ bool TabBox::Add(Control* pControl)

if(m_iCurSel == -1 && pControl->IsVisible()) {
m_iCurSel = GetItemIndex(pControl);
}
else {
}

if (m_iCurSel != GetItemIndex(pControl) || !pControl->IsVisible())
{
if (!IsFadeSwitch()) {
pControl->SetVisible(false);
}
Expand All @@ -27,7 +29,6 @@ bool TabBox::Add(Control* pControl)
}
pControl->SetAlpha(0);
}

return ret;
}

Expand Down Expand Up @@ -221,7 +222,7 @@ bool TabBox::SelectItem(const std::wstring& pControlName)

void TabBox::SetAttribute(const std::wstring& strName, const std::wstring& strValue)
{
if( strName == _T("selectedid") ) SelectItem(_ttoi(strValue.c_str()));
if (strName == _T("selectedid")) m_iCurSel = _ttoi(strValue.c_str());
else if( strName == _T("fadeswitch") ) SetFadeSwitch(strValue == _T("true"));
else Box::SetAttribute(strName, strValue);
}
Expand Down

0 comments on commit f8cd48c

Please sign in to comment.