Fix exception when no selection in HyperTreeList

If a HyperTreeList is created with only the root item present, and not
selected, an exception will be thrown if any key is pressed.
GetFirstVisibleItem() returns None, even though the root item is
present and visible. Only an issue if the TR_MULTIPLE flag is set.
This commit is contained in:
cbeytas
2018-11-21 14:16:50 -05:00
parent 435d228196
commit 87b100649e

View File

@@ -2348,7 +2348,15 @@ class TreeListMainWindow(CustomTreeCtrl):
def GetFirstVisibleItem(self):
""" Returns the first visible item. """
return self.GetNextVisible(self.GetRootItem())
root = self.GetRootItem()
if not root:
return None
if not self.HasAGWFlag(TR_HIDE_ROOT):
if self.IsVisible(root):
return root
return self.GetNextVisible(root)
def GetPrevVisible(self, item):