From 46dba5245e3e58e9556b0ccc62d79ea310d5784f Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sat, 23 Sep 2023 17:56:55 +0000 Subject: [PATCH] NiceGrid: Fix endless loop when colwidths are changed so that a horizontal scrollbar is about to disappear (https://forum.lazarus.freepascal.org/index.php?topic=64703). git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8924 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/nicegrid/source/nicegrid.pas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/nicegrid/source/nicegrid.pas b/components/nicegrid/source/nicegrid.pas index d6acc90cb..e6fc50eb4 100644 --- a/components/nicegrid/source/nicegrid.pas +++ b/components/nicegrid/source/nicegrid.pas @@ -999,8 +999,10 @@ begin FHorzOffset := Max(0, Min(FHorzOffset, FMaxHScroll)); FVertOffset := Max(0, Min(FVertOffset, FMaxVScroll)); - SetScrollBar(SB_HORZ, FMaxHScroll, FHorzOffset, SIF_POS or SIF_RANGE); - SetScrollBar(SB_VERT, FMaxVScroll, FVertOffset, SIF_POS or SIF_RANGE); + if FHorzOffset <> 0 then + SetScrollBar(SB_HORZ, FMaxHScroll, FHorzOffset, SIF_POS or SIF_RANGE); + if FVertOffset <> 0 then + SetScrollBar(SB_VERT, FMaxVScroll, FVertOffset, SIF_POS or SIF_RANGE); AllWidth := Min(ClientWidth, BodyWidth + FixedWidth); if FShowFooter then