Fix first menuitem being outlined in all menus
This commit is contained in:
parent
2cad49162d
commit
824655c67f
4 changed files with 7 additions and 8 deletions
|
@ -72,10 +72,7 @@ min(
|
|||
[listbox]
|
||||
id = "list"
|
||||
definition = "default"
|
||||
# TODO: this makes it so the list doesn't have an initial selection, which is
|
||||
# appropriate for right click menus, but possibly not when used in tandem with
|
||||
# the menu button widget.
|
||||
#has_minimum = "false"
|
||||
has_minimum = "false"
|
||||
|
||||
[list_definition]
|
||||
|
||||
|
|
|
@ -94,7 +94,9 @@ void tdrop_down_list::pre_show(twindow& window)
|
|||
}
|
||||
}
|
||||
|
||||
list.select_row(selected_item_);
|
||||
if(selected_item_ >= 0 && unsigned(selected_item_) < list.get_item_count()) {
|
||||
list.select_row(selected_item_);
|
||||
}
|
||||
|
||||
list.set_callback_item_change(std::bind(&tdrop_down_list::item_change_callback, this, std::ref(window), _1));
|
||||
|
||||
|
|
|
@ -150,9 +150,9 @@ struct tone : public virtual tgenerator_
|
|||
if(get_selected_item_count() == 1) {
|
||||
// deselect current.
|
||||
do_deselect_item(get_selected_item());
|
||||
// select new.
|
||||
do_select_item(index);
|
||||
}
|
||||
// select new.
|
||||
do_select_item(index);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -368,7 +368,7 @@ void command_executor::show_menu(const std::vector<std::string>& items_arg, int
|
|||
int res = -1;
|
||||
{
|
||||
SDL_Rect pos = {xloc, yloc, 1, 1};
|
||||
gui2::tdrop_down_list mmenu(pos, menu, 0, false);
|
||||
gui2::tdrop_down_list mmenu(pos, menu, -1, false);
|
||||
mmenu.show(gui.video());
|
||||
if(mmenu.get_retval() == gui2::twindow::OK) {
|
||||
res = mmenu.selected_item();
|
||||
|
|
Loading…
Add table
Reference in a new issue