NiceGrid: Alternate solution to r8924.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8925 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-09-23 20:40:21 +00:00
parent 6fd35ce8df
commit b5412c3f5b

View File

@ -285,7 +285,6 @@ type
procedure WMVScroll(var Msg: TLMVScroll); message LM_VSCROLL;
procedure WMHScroll(var Msg: TLMHScroll); message LM_HSCROLL;
procedure WMMouseWheel(var Msg: TLMessage{TWMMouseWheel}); message LM_MOUSEWHEEL;
procedure WMSize(var Msg: TLMessage); message LM_SIZE;
procedure WMEraseBkgnd(var Msg: TLMEraseBkGnd); message LM_ERASEBKGND;
// procedure WMSetFocus(var Msg: TLMSetFocus); message LM_SETFOCUS;
// procedure WMKillFocus(var Msg: TLMKillFocus); message LM_KILLFOCUS;
@ -411,6 +410,7 @@ type
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy; const AXProportion, AYProportion: Double); override;
procedure DoEnter; override;
procedure DoExit; override;
procedure DoOnResize; override;
{$ENDIF}
public
@ -999,10 +999,8 @@ begin
FHorzOffset := Max(0, Min(FHorzOffset, FMaxHScroll));
FVertOffset := Max(0, Min(FVertOffset, FMaxVScroll));
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);
SetScrollBar(SB_HORZ, FMaxHScroll, FHorzOffset, SIF_POS or SIF_RANGE);
SetScrollBar(SB_VERT, FMaxVScroll, FVertOffset, SIF_POS or SIF_RANGE);
AllWidth := Min(ClientWidth, BodyWidth + FixedWidth);
if FShowFooter then
@ -2930,12 +2928,16 @@ begin
do FColumns[x].Font.Assign(Font);
end;
procedure TNiceGrid.WMSize(var Msg: {$IFDEF FPC}TLMessage{$ELSE}TMessage{$ENDIF});
{$IFDEF FPC}
procedure TNiceGrid.DoOnResize;
{$ELSE}
procedure TNiceGrid.WMSize(var Msg: TMessage);
{$ENDIF}
begin
inherited;
Recalculate;
if (FColumns.Count > 0)
then EnsureVisible(FCol, FRow);
if (FColumns.Count > 0) then
EnsureVisible(FCol, FRow);
end;
procedure TNiceGrid.WMEraseBkgnd(var Msg: {$IFDEF FPC}TLMEraseBkGnd{$ELSE}TWMEraseBkGnd{$ENDIF});