From fbb376d7781d7056e1b01f1a52b6785c5bab2465 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Wed, 21 Jun 2017 08:29:25 +0000 Subject: [PATCH] fpspreadsheet: Fix changing of WorksheetGrid column width/row height by dragging with the mouse. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5950 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../source/visual/fpspreadsheetgrid.pas | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas b/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas index a78e11755..2f2a22ca7 100644 --- a/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas +++ b/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas @@ -293,6 +293,7 @@ type procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; function MouseOnCellBorder(const APoint: TPoint; const ACellRect: TGridRect): Boolean; + function MouseOnHeader(X, Y: Integer): Boolean; procedure MouseUp(Button: TMouseButton; Shift:TShiftState; X,Y:Integer); override; procedure MoveSelection; override; procedure Notification(AComponent: TComponent; Operation: TOperation); override; @@ -5031,6 +5032,9 @@ begin inherited; + if MouseOnHeader(X,Y) then + exit; + if FTextOverflow and ((prevMouseCell.X <> GCache.MouseCell.X) or (prevMouseCell.Y <> GCache.MouseCell.Y)) then @@ -5067,6 +5071,17 @@ begin Result := PtInRect(R1, APoint) and not PtInRect(R2, APoint); end; +function TsCustomWorksheetGrid.MouseOnHeader(X, Y: Integer): Boolean; +var + R: TRect; +begin + if FHeaderCount = 0 then + exit(false); + + R := CellRect(0, 0); + Result := (Y < R.Bottom) or (X < R.Right); +end; + procedure TsCustomWorksheetGrid.MouseUp(Button: TMouseButton; Shift:TShiftState; X,Y:Integer); begin