Remember and restore focus for all tabs of a Dialog

This commit is contained in:
thrust26 2018-12-30 10:37:59 +01:00
parent cd8d7498d3
commit 33f7c5b7e8
3 changed files with 10 additions and 6 deletions

View File

@ -99,12 +99,11 @@ void Dialog::open()
center();
// (Re)-build the focus list to use for all widgets of all tabs
for(auto& tabfocus : _myTabList)
buildCurrentFocusList(tabfocus.widget->getID());
// (Re)-build the focus list to use for the widgets which are currently
// onscreen
buildCurrentFocusList(0);
loadConfig();
loadConfig(); // has to be done AFTER (re)building the focus list
_visible = true;
@ -178,6 +177,10 @@ void Dialog::releaseFocus()
{
if(_focusedWidget)
{
// remember focus of all tabs for when dialog is reopened again
for(auto& tabfocus : _myTabList)
tabfocus.saveCurrentFocus(_focusedWidget);
_focusedWidget->lostFocus();
_focusedWidget = nullptr;
}

View File

@ -131,7 +131,7 @@ GameInfoDialog::GameInfoDialog(
"(*) Changes require a ROM reload");
// Add items for tab 0
addToFocusList(wid, myTab, tabID);
addToFocusList(wid, myTab, tabID);
//////////////////////////////////////////////////////////////////////////////
// 2) Console properties

View File

@ -32,6 +32,7 @@
#include "TabWidget.hxx"
#include "NTSCFilter.hxx"
#include "TIASurface.hxx"
#include "VideoDialog.hxx"
namespace {