From 86dff7396e950df8efd1f2a98888822dd16be7fc Mon Sep 17 00:00:00 2001 From: Krzysztof Dermont Date: Sun, 5 Jul 2020 22:01:05 +0200 Subject: [PATCH] Disable Delete/Load buttons if no save selected --- src/ui/screen/screen_io.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/ui/screen/screen_io.cpp b/src/ui/screen/screen_io.cpp index 46d90336..2f818b3e 100644 --- a/src/ui/screen/screen_io.cpp +++ b/src/ui/screen/screen_io.cpp @@ -143,6 +143,19 @@ void CScreenIO::IOUpdateList(bool isWrite) sel = pl->GetSelect(); max = pl->GetTotal(); + // enable/disable buttons if we have selected a game + pb = static_cast(pw->SearchControl(EVENT_INTERFACE_IODELETE)); + if ( pb != nullptr ) + { + pb->SetState(STATE_ENABLE, (!isWrite && sel < max) || (isWrite && sel < max - 1)); + } + + pb = static_cast(pw->SearchControl(EVENT_INTERFACE_IOREAD)); + if ( pb != nullptr ) + { + pb->SetState(STATE_ENABLE, sel < max); + } + if (m_saveList.size() <= static_cast(sel)) return; @@ -157,12 +170,6 @@ void CScreenIO::IOUpdateList(bool isWrite) { pi->SetFilenameImage(""); } - - pb = static_cast(pw->SearchControl(EVENT_INTERFACE_IODELETE)); - if ( pb != nullptr ) - { - pb->SetState(STATE_ENABLE, sel < max-1); - } } else {