Browse Source

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
rdb 4 years ago
parent
commit
fe29aab568
1 changed files with 1 additions and 0 deletions
  1. 1 0
      direct/src/gui/DirectOptionMenu.py

+ 1 - 0
direct/src/gui/DirectOptionMenu.py

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