mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-10 19:57:05 +00:00
gui2/tfile_dialog: Make it so the fileview and textbox "share" the focus
This allows the user to use the arrow keys to select fileview entries, and character keys to enter a name into the textbox below, just like in the GUI1 version. Thanks to celticminstrel and vultraz for the tip.
This commit is contained in:
parent
ddd3dc7261
commit
8c14dc1872
@ -211,7 +211,8 @@ void tfile_dialog::pre_show(twindow& window)
|
|||||||
|
|
||||||
refresh_fileview(window);
|
refresh_fileview(window);
|
||||||
|
|
||||||
window.keyboard_capture(&filelist);
|
window.keyboard_capture(&find_widget<ttext_box>(&window, "filename", false));
|
||||||
|
window.add_to_keyboard_chain(&filelist);
|
||||||
window.set_exit_hook(std::bind(&tfile_dialog::on_exit, this, std::ref(window)));
|
window.set_exit_hook(std::bind(&tfile_dialog::on_exit, this, std::ref(window)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,6 +501,10 @@ void tfile_dialog::on_row_selected(twindow& window)
|
|||||||
} else {
|
} else {
|
||||||
clear_input_text(file_textbox);
|
clear_input_text(file_textbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Need to do this every time so that input can still be sent to the
|
||||||
|
// textbox without clicking on it.
|
||||||
|
window.keyboard_capture(&file_textbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tfile_dialog::on_dir_create_cmd(twindow& window)
|
void tfile_dialog::on_dir_create_cmd(twindow& window)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user