Phoenix
Phoenix copied to clipboard
AGW CustomTreeCtrl.PaintItem() getting wrong size for full row item highlight
Operating system: Windows 10 wxPython version & source: 4.1.1, pypi Python version & source: 3.7, stock
Description of the problem:
Sorry for the long title... I found that in PaintItem() on Line 6749 the function is using the Client width to draw a full row highlight. If the expanded items cause horizontal scrollbars to be needed, then the selected item does not get highlighted all the way to the right.
Solution:
Change to w, h = self.GetVirtualSize()
Code Example (click to expand)
import wx.lib.agw.customtreectrl as ctc
if __name__ == '__main__':
class TestFrame(wx.Frame):
def __init__(self, parent=None, title='Test SuperScrolledWindow', style=wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP):
super(TestFrame, self).__init__(parent=parent, title=title, style=style, size=(350, 350))
sizer = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(sizer)
tree = ctc.CustomTreeCtrl(parent=self, agwStyle=ctc.TR_FULL_ROW_HIGHLIGHT)
sizer.Add(tree, proportion=1, flag=wx.EXPAND | wx.ALL, border=10)
root = tree.AddRoot(text="ROOT")
for x in range(4):
item = tree.AppendItem(parentId=root, text="askjfvliasubrviluaberiuvarb")
for y in range(3):
tree.AppendItem(parentId=item, text="kkunaer978h ar98s7hv986agervsdfsdfsdfsdfsdfsdfsdfsdf")
tree.ExpandAll()
self.Layout()
self.Fit()
self.SetInitialSize((300, 300))
app = wx.App(False)
frame = TestFrame()
frame.Show()
app.MainLoop()
app.ExitMainLoop()
app.Destroy()
Could you see if the pull request fixes the issue in your application?