GUI: Focus the first 'focusable' widget when rebuilding dialogs
Fixes Trac#9838.
This commit is contained in:
parent
1e64ef48e0
commit
9bb9c0d58e
4 changed files with 15 additions and 9 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue