Disable Delete/Load buttons if no save selected

1164-fix
Krzysztof Dermont 2020-07-05 22:01:05 +02:00 committed by Mateusz Przybył
parent 1cffbb2bd3
commit 86dff7396e
1 changed files with 13 additions and 6 deletions

View File

@ -143,6 +143,19 @@ void CScreenIO::IOUpdateList(bool isWrite)
sel = pl->GetSelect(); sel = pl->GetSelect();
max = pl->GetTotal(); max = pl->GetTotal();
// enable/disable buttons if we have selected a game
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_IODELETE));
if ( pb != nullptr )
{
pb->SetState(STATE_ENABLE, (!isWrite && sel < max) || (isWrite && sel < max - 1));
}
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_IOREAD));
if ( pb != nullptr )
{
pb->SetState(STATE_ENABLE, sel < max);
}
if (m_saveList.size() <= static_cast<unsigned int>(sel)) if (m_saveList.size() <= static_cast<unsigned int>(sel))
return; return;
@ -157,12 +170,6 @@ void CScreenIO::IOUpdateList(bool isWrite)
{ {
pi->SetFilenameImage(""); pi->SetFilenameImage("");
} }
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_IODELETE));
if ( pb != nullptr )
{
pb->SetState(STATE_ENABLE, sel < max-1);
}
} }
else else
{ {