Fix bad window position on add

If a window is created and added to CustomTreeCtrl or HyperTreeList its initial position will be incorrect and if the item it was added to is hidden (child of collapsed item) the window will be shown in an incorrect spot (usually 0,0 i.e. top-left of control).
This commit is contained in:
cbeytas
2018-11-22 21:39:51 -05:00
parent c06fef9ccb
commit f6e7064b55
2 changed files with 6 additions and 6 deletions

View File

@@ -1961,9 +1961,9 @@ class GenericTreeItem(object):
self._width = size.GetWidth()
self._windowsize = size
# We don't show the window if the item is collapsed
if not self.IsExpanded():
self._wnd.Show(False)
## Hide the window since the position isn't correct yet. It will
## be shown and positioned when the item is painted.
wnd.Show(False)
# The window is enabled only if the item is enabled
self._wnd.Enable(self._enabled)

View File

@@ -1669,9 +1669,9 @@ class TreeListItem(GenericTreeItem):
# Do better strategies exist?
wnd.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
# We don't show the window if the item is collapsed
if not self.IsExpanded():
wnd.Show(False)
## Hide the window since the position isn't correct yet. It will
## be shown and positioned when the item is painted.
wnd.Show(False)
# The window is enabled only if the item is enabled
wnd.Enable(self._enabled)