diff options
author | Bastien Bouclet | 2017-06-13 07:18:33 +0200 |
---|---|---|
committer | Bastien Bouclet | 2017-06-13 07:21:34 +0200 |
commit | 9bb9c0d58eea71292d05b4e5515c48ba53d1f194 (patch) | |
tree | 93c81c355bfa3c17dea858a7e0d2b223db3400a1 /gui/dialog.cpp | |
parent | 1e64ef48e090db528ed25531c69fd569677733fd (diff) | |
download | scummvm-rg350-9bb9c0d58eea71292d05b4e5515c48ba53d1f194.tar.gz scummvm-rg350-9bb9c0d58eea71292d05b4e5515c48ba53d1f194.tar.bz2 scummvm-rg350-9bb9c0d58eea71292d05b4e5515c48ba53d1f194.zip |
GUI: Focus the first 'focusable' widget when rebuilding dialogs
Fixes Trac#9838.
Diffstat (limited to 'gui/dialog.cpp')
-rw-r--r-- | gui/dialog.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp index d0e5755a59..24b3db4d6d 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -88,13 +88,7 @@ void Dialog::open() { _visible = true; g_gui.openDialog(this); - Widget *w = _firstWidget; - // Search for the first objects that wantsFocus() (if any) and give it the focus - while (w && !w->wantsFocus()) { - w = w->_next; - } - - setFocusWidget(w); + setDefaultFocusedWidget(); } void Dialog::close() { @@ -142,6 +136,16 @@ void Dialog::setFocusWidget(Widget *widget) { _focusedWidget = widget; } +void Dialog::setDefaultFocusedWidget() { + Widget *w = _firstWidget; + // Search for the first objects that wantsFocus() (if any) and give it the focus + while (w && !w->wantsFocus()) { + w = w->_next; + } + + setFocusWidget(w); +} + void Dialog::releaseFocus() { if (_focusedWidget) { _focusedWidget->lostFocus(); |