From 1583512c049e036037cdef3ca580860e8a77fc7d Mon Sep 17 00:00:00 2001 From: maxim Date: Fri, 18 Oct 2019 22:03:17 +0000 Subject: [PATCH] Merged revision(s) 61053 #6096106179, 61740 #563a44c1d6, 61945-61947 #96eee65d5d-#96eee65d5d, 62031 #9cad1b3feb from trunk: LCL: Handle mouse events through shaped TWinControl. Issue #35270, patch from ptvs. ........ lcl, fix TDbgrid wrong width of first column if FixedCells>1 and dgIndicator is turned off, issue #35716 ........ LCL: override TSpinEdit.GetLimitedValue so it cannot return values outside the integer range. Issue #0032793. ........ LCL: fix crash in TStringGrid.InsertRowWithValues is Columns.Enabled is True. Issue #0036067 ........ LCL: fix TTaskDialog.ModalResult if closebutton (in CommonButtons) is clicked. Issue #0036069. ........ LCL/grids: Fix misplaced horizontal grid scrollbar after form maximize. Issue #35472, patch by Pavol S. ........ git-svn-id: branches/fixes_2_0@62082 - --- lcl/grids.pas | 23 +++++++++++++++++------ lcl/include/spinedit.inc | 10 ++++++++++ lcl/include/taskdialog.inc | 14 +++++++++++++- lcl/include/wincontrol.inc | 10 +--------- lcl/lcltaskdialog.pas | 2 +- lcl/spin.pp | 1 + 6 files changed, 43 insertions(+), 17 deletions(-) diff --git a/lcl/grids.pas b/lcl/grids.pas index 026ffd4f15..f1df0fd640 100644 --- a/lcl/grids.pas +++ b/lcl/grids.pas @@ -2536,7 +2536,7 @@ function TCustomGrid.GetColWidths(Acol: Integer): Integer; var C: TGridColumn; begin - if not Columns.Enabled or (aCol=0) then Result:=FCols[aCol] @@ -7798,14 +7798,17 @@ end; procedure TCustomGrid.UpdateHorzScrollBar(const aVisible: boolean; const aRange,aPage,aPos: Integer); +var + NeedUpdate: Boolean; begin {$ifdef DbgScroll} DebugLn('TCustomGrid.UpdateHorzScrollbar: Vis=%s Range=%d Page=%d aPos=%d', [dbgs(aVisible),aRange, aPage, aPos]); {$endif} - if FHSbVisible<>Ord(aVisible) then + NeedUpdate := FHSbVisible <> Ord(AVisible); + if NeedUpdate then ScrollBarShow(SB_HORZ, aVisible); - if aVisible then + if aVisible or NeedUpdate then ScrollBarRange(SB_HORZ, aRange, aPage, aPos); end; @@ -11673,11 +11676,19 @@ end; procedure TCustomStringGrid.InsertRowWithValues(Index: Integer; Values: array of String); var - i, OldRC: Integer; + i, OldRC, Diff: Integer; begin OldRC := RowCount; - if Length(Values) > ColCount then - ColCount := Length(Values); + Diff := Length(Values) - ColCount; + if Diff > 0 then + begin + if Columns.Enabled then + begin + for i := 1 to Diff do with Columns.Add do Title.Caption := ''; + end + else + ColCount := Length(Values); + end; InsertColRow(false, Index); //if RowCount was 0, then setting ColCount restores RowCount (from FGridPropBackup) //which is unwanted here, so reset it (Issue #0026943) diff --git a/lcl/include/spinedit.inc b/lcl/include/spinedit.inc index 016fc2f68b..e8b88289c8 100644 --- a/lcl/include/spinedit.inc +++ b/lcl/include/spinedit.inc @@ -272,4 +272,14 @@ begin FDecimals := 0; end; +function TCustomSpinEdit.GetLimitedValue(const AValue: Double): Double; +begin + //The WS may call this function for both TSpinEdit and TFloatSPinEdit, so we cannot change signature to have integer parameters + Result := inherited GetLimitedValue(AValue); + if Result > MaxInt then + Result := MaxInt; + if Result < Low(Integer) then + Result := Low(Integer); +end; + // included by spin.pp diff --git a/lcl/include/taskdialog.inc b/lcl/include/taskdialog.inc index 7b805a8af4..8e73099c78 100644 --- a/lcl/include/taskdialog.inc +++ b/lcl/include/taskdialog.inc @@ -99,7 +99,19 @@ function TCustomTaskDialog.ButtonIDToModalResult(const AButtonID: Integer ): TModalResult; begin if AButtonID<100 then - Result := AButtonID + begin + case AButtonID of + IDOK: Result := mrOK; + IDCANCEL: Result := mrCancel; + IDABORT: Result := mrAbort; + IDRETRY: Result := mrRetry; + IDIGNORE: Result := mrIgnore; + IDYES: Result := mrYes; + IDNO: Result := mrNo; + IDCLOSE: Result := mrClose; + else Result := AButtonID + end; + end else if (AButtonID-100 ignore here - Control := nil; - end; + Control := ControlAtPos(SmallPointToPoint(MouseMessage.Pos), []); end; //DebugLn(['TWinControl.IsControlMouseMsg B ',DbgSName(Self),' Control=',DbgSName(Control),' Msg=',TheMessage.Msg]); diff --git a/lcl/lcltaskdialog.pas b/lcl/lcltaskdialog.pas index 6cf833bd18..25f2f5eed8 100644 --- a/lcl/lcltaskdialog.pas +++ b/lcl/lcltaskdialog.pas @@ -446,7 +446,7 @@ end; const TD_BTNMOD: array[TCommonButton] of Integer = ( - mrOk, mrYes, mrNo, mrCancel, mrRetry, mrAbort); + mrOk, mrYes, mrNo, mrCancel, mrRetry, mrClose); function TD_BTNS(button: TCommonButton): pointer; begin diff --git a/lcl/spin.pp b/lcl/spin.pp index 6f2645198f..68ec1a75b9 100644 --- a/lcl/spin.pp +++ b/lcl/spin.pp @@ -144,6 +144,7 @@ type procedure SetValue(const AValue: integer); overload; virtual; public constructor Create(TheOwner: TComponent); override; + function GetLimitedValue(const AValue: Double): Double; override; public property Value: integer read GetValue write SetValue default 0; property MinValue: integer read GetMinValue write SetMinValue default 0;