fix menuinitselection for dynamic menus

If a menu is not (yet) big enough for the selection to be set, wait until
the menu is opened and initialised - then try again.
This commit is contained in:
ac-stef
2016-10-01 20:08:25 +02:00
parent 13e6460ff3
commit 07d9ae608d
2 changed files with 4 additions and 2 deletions
+2
View File
@@ -939,6 +939,7 @@ void menuinitselection(int *line)
{
if(!lastmenu) return;
if(lastmenu->items.inrange(*line)) lastmenu->menusel = *line;
else lastmenu->menuselinit = *line;
}
COMMAND(menuinitselection, "i");
@@ -1316,6 +1317,7 @@ void gmenu::open()
execute(initaction);
lastmenu = oldlastmenu;
}
if(items.inrange(menuselinit)) { menusel = menuselinit; menuselinit = -1; }
if(items.inrange(menusel)) items[menusel]->focus(true);
init();
resetcontext();