TTreeView content with CustomDrawn items not shown correctly after Scrollbars are hidden with ssAutoVertical
Original Reporter info from Mantis: nappsoft
-
Reporter name:
Original Reporter info from Mantis: nappsoft
- Reporter name:
Description:
When changing the size of a TTreeView with visible scrollbars so that the scrollbars can be hidden (as after changing the size the height of the TTreeView component is > than the space needed by its content), the content is sometimes not rendered correctly any longer until the TTreeView is resized again. (Not even calling TTreeView.Repaint helps in this situation).
This only happens when the scrollposition is not at the top of the TTreeView when resizing.
Steps to reproduce:
(testet on Win32 and Linux/GTK2 with custom drawn elements)
- set scrollbars in a TTreeView to ssAutoVertical
- set the anchors of the TTreeView to [akTop, akLeft, akBottom]
- fill a TTreeView with enough elements so that the vertical scrollbar needs to be shown
- scroll to the end of the TTreeView
- resize the Form containing the TTreeView (do this fast, if one does it slow enough the problem doesn't occur!)
Additional information:
It seems like the information received via GetScrollInfo inside OnCustomDrawItem seems to be wrong in this scenario (to know about the offset for rendering I need to do the following):
TempScrollInfo.cbSize := SizeOf(TAGSCROLLINFO);
TempScrollInfo.fMask := SIF_POS;
scrollbar_visible:=GetScrollInfo(Sender.Handle, SB_VERT, TempScrollInfo);
if scrollbar_visible then
offset:=TempScrollInfo.nPos
else
offset:=0;
I was able to fix the problem quite easily on Linux and on Windows, see the attached patch.
Mantis conversion info:
- Mantis ID: 36731
- Version: 2.0.7 (SVN)
- Fixed in revision: r62843 (#7c479cba)