From 5f5e1fbd5b1af66223a1184892b2d5dbadd6ab1e Mon Sep 17 00:00:00 2001 From: cbeytas Date: Wed, 21 Nov 2018 14:29:45 -0500 Subject: [PATCH] Fix window positioning during draw In CustomTreeCtrl and HyperTreeList the `SetPosition` method is used to adjust window positions. This can't set a Y value of -1 and instead leaves the window at its last position. Use the `Move` method instead. Also made sure this positioning is done before a possible call to the `Show` method which prevents some flicker. --- wx/lib/agw/customtreectrl.py | 5 +++-- wx/lib/agw/hypertreelist.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/wx/lib/agw/customtreectrl.py b/wx/lib/agw/customtreectrl.py index 81c48c45..d10a0182 100644 --- a/wx/lib/agw/customtreectrl.py +++ b/wx/lib/agw/customtreectrl.py @@ -6824,10 +6824,11 @@ class CustomTreeCtrl(wx.ScrolledWindow): # Rightmost alignment of windows wndx = w - item.GetWindowSize().x - 2 + xa + if wnd.GetPosition() != (wndx, ya): + wnd.Move(wndx, ya, flags=wx.SIZE_ALLOW_MINUS_ONE) + # Force window visible after any position changes were made. if not wnd.IsShown(): wnd.Show() - if wnd.GetPosition() != (wndx, ya): - wnd.SetPosition((wndx, ya)) if separator: oldPen = dc.GetPen() diff --git a/wx/lib/agw/hypertreelist.py b/wx/lib/agw/hypertreelist.py index f96fca98..6adaf4ad 100644 --- a/wx/lib/agw/hypertreelist.py +++ b/wx/lib/agw/hypertreelist.py @@ -3052,10 +3052,11 @@ class TreeListMainWindow(CustomTreeCtrl): if item.GetHeight() > item.GetWindowSize(i)[1]: ya += (item.GetHeight() - item.GetWindowSize(i)[1])//2 + if wnd.GetPosition() != (wndx, ya): + wnd.Move(wndx, ya, flags=wx.SIZE_ALLOW_MINUS_ONE) + # Force window visible after any position changes were made. if not wnd.IsShown(): wnd.Show() - if wnd.GetPosition() != (wndx, ya): - wnd.SetPosition((wndx, ya)) x_colstart += col_w dc.DestroyClippingRegion()