aboutsummaryrefslogtreecommitdiff
path: root/gui/dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/dialog.cpp')
-rw-r--r--gui/dialog.cpp18
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();