View Issue Details

IDProjectCategoryView StatusLast Update
0036731LazarusLCLpublic2020-04-01 12:44
Reporternappsoft Assigned ToJuha Manninen  
Status resolvedResolutionfixed 
Product Version2.0.7 (SVN) 
Summary0036731: TTreeView content with CustomDrawn items not shown correctly after Scrollbars are hidden with ssAutoVertical
DescriptionWhen 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 InformationIt 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

I was able to fix the problem quite easily on Linux and on Windows, see the attached patch.
TagsNo tags attached.
Fixed in Revisionr62843
WidgetsetGTK 2, Win32/Win64
Attached Files



2020-02-25 14:56


lazarus.diff (563 bytes)   
--- 1/lazarus/lcl/include/	2020-02-10 15:18:46.593796761 +0100
+++ 2/lazarus/lcl/include/	2020-02-25 10:03:16.653355600 +0100
@@ -4355,6 +4355,8 @@
       if (fScrollBars in [ssAutoBoth, ssAutoVertical])
       and (ScrollInfo.nPage>=cardinal(ScrollInfo.nMax)) then begin
         //DebugLn(['TCustomTreeView.UpdateScrollbars Hide Vertical.']);
+        ScrollInfo.nPos:=0;
+        SetScrollInfo(Handle, SB_VERT, ScrollInfo, false);
         SetShowScrollBar(SB_VERT, false);
       end else begin
lazarus.diff (563 bytes)   

Juha Manninen

2020-04-01 12:44

developer   ~0121827

Applied, thanks.

Issue History

Date Modified Username Field Change
2020-02-25 14:56 nappsoft New Issue
2020-02-25 14:56 nappsoft File Added: lazarus.diff
2020-04-01 07:08 Juha Manninen Assigned To => Juha Manninen
2020-04-01 07:08 Juha Manninen Status new => assigned
2020-04-01 12:44 Juha Manninen Status assigned => resolved
2020-04-01 12:44 Juha Manninen Resolution open => fixed
2020-04-01 12:44 Juha Manninen Fixed in Revision => r62843
2020-04-01 12:44 Juha Manninen LazTarget => -
2020-04-01 12:44 Juha Manninen Widgetset GTK 2, Win32/Win64 => GTK 2, Win32/Win64
2020-04-01 12:44 Juha Manninen Note Added: 0121827