dgui: Reset DirectOptionMenu highlighted index when replacing items

Not doing this causes issues if the item list is replaced by an item callback, since that means the unhighlight callback is never fired.

Fixes #1125
This commit is contained in:
rdb 2021-03-22 10:05:03 +01:00
parent c1fbb70c6d
commit fe29aab568

View File

@ -114,6 +114,7 @@ class DirectOptionMenu(DirectButton):
)
# Make sure it is on top of all the other gui widgets
self.popupMenu.setBin('gui-popup', 0)
self.highlightedIndex = None
if not self['items']:
return
# Create a new component for each item