Addon Manager: give addon list keyboard focus when opening manager

This commit is contained in:
Charles Dang 2017-03-13 23:07:52 +11:00
parent 2c9d0104c9
commit e43c65a689
3 changed files with 12 additions and 1 deletions

View file

@ -427,7 +427,7 @@ void addon_manager::pre_show(window& window)
on_addon_select(window);
window.keyboard_capture(&filter);
//window.add_to_keyboard_chain(&list.get_listbox());
list.add_list_to_keyboard_chain();
// Use handle the special addon_list retval to allow installing addons on double click
window.set_exit_hook(std::bind(&addon_manager::exit_hook, this, std::ref(window)));

View file

@ -29,6 +29,7 @@
#include "gui/widgets/settings.hpp"
#include "gui/widgets/stacked_widget.hpp"
#include "gui/widgets/toggle_panel.hpp"
#include "gui/widgets/window.hpp"
#include "wml_exception.hpp"
#include <algorithm>
@ -317,6 +318,13 @@ listbox& addon_list::get_listbox()
return find_widget<listbox>(&get_grid(), "addons", false);
}
void addon_list::add_list_to_keyboard_chain()
{
if(window* window = get_window()) {
window->add_to_keyboard_chain(&get_listbox());
}
}
void addon_list::finalize_setup()
{
listbox& list = get_listbox();

View file

@ -125,6 +125,9 @@ public:
install_buttons_visibility_ = visibility;
}
/** Adds the internal listbox to the keyboard event chain. */
void add_list_to_keyboard_chain();
/** See @ref styled_widget::set_active. */
virtual void set_active(const bool) override
{