mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-16 09:40:07 +01:00
Properly update tree when windows added or removed
In CustromTreeCtrl and HyperTreeList when a window is added or deleted from an item the row height can change causing the entire tree to change shape. This sets the _dirty flag so the tree gets recalcualted during the next Idle handler. In HyperTreeList deleting an item didn't properly remove it from the _itemWithWindow list.
This commit is contained in:
@@ -4375,6 +4375,7 @@ class CustomTreeCtrl(wx.ScrolledWindow):
|
||||
item.DeleteWindow()
|
||||
if item in self._itemWithWindow:
|
||||
self._itemWithWindow.remove(item)
|
||||
self._dirty = True
|
||||
|
||||
|
||||
def GetItemWindowEnabled(self, item):
|
||||
|
||||
@@ -1726,9 +1726,12 @@ class TreeListItem(GenericTreeItem):
|
||||
if column >= len(self._wnd):
|
||||
return
|
||||
|
||||
if self._wnd[column]:
|
||||
self._wnd[column].Destroy()
|
||||
wnd = self._wnd[column]
|
||||
if wnd:
|
||||
wnd.Destroy()
|
||||
self._wnd[column] = None
|
||||
if not any(self._wnd) and self in self._owner._itemWithWindow:
|
||||
self._owner._itemWithWindow.remove(self)
|
||||
|
||||
|
||||
def GetWindowEnabled(self, column=None):
|
||||
@@ -2270,6 +2273,8 @@ class TreeListMainWindow(CustomTreeCtrl):
|
||||
if window:
|
||||
self._hasWindows = True
|
||||
|
||||
# Recalculate tree during idle time.
|
||||
self._dirty = True
|
||||
|
||||
def SetItemWindowEnabled(self, item, enable=True, column=None):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user