mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 11:30:06 +01:00
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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user