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 -
This commit is contained in:
maxim 2019-10-18 22:03:17 +00:00
parent 4455557d6e
commit 1583512c04
6 changed files with 43 additions and 17 deletions

View File

@ -2536,7 +2536,7 @@ function TCustomGrid.GetColWidths(Acol: Integer): Integer;
var var
C: TGridColumn; C: TGridColumn;
begin begin
if not Columns.Enabled or (aCol<FixedCols) then if not Columns.Enabled or (aCol<FirstGridColumn) then
begin begin
if (aCol<ColCount) and (aCol>=0) then if (aCol<ColCount) and (aCol>=0) then
Result:=FCols[aCol] Result:=FCols[aCol]
@ -7798,14 +7798,17 @@ end;
procedure TCustomGrid.UpdateHorzScrollBar(const aVisible: boolean; procedure TCustomGrid.UpdateHorzScrollBar(const aVisible: boolean;
const aRange,aPage,aPos: Integer); const aRange,aPage,aPos: Integer);
var
NeedUpdate: Boolean;
begin begin
{$ifdef DbgScroll} {$ifdef DbgScroll}
DebugLn('TCustomGrid.UpdateHorzScrollbar: Vis=%s Range=%d Page=%d aPos=%d', DebugLn('TCustomGrid.UpdateHorzScrollbar: Vis=%s Range=%d Page=%d aPos=%d',
[dbgs(aVisible),aRange, aPage, aPos]); [dbgs(aVisible),aRange, aPage, aPos]);
{$endif} {$endif}
if FHSbVisible<>Ord(aVisible) then NeedUpdate := FHSbVisible <> Ord(AVisible);
if NeedUpdate then
ScrollBarShow(SB_HORZ, aVisible); ScrollBarShow(SB_HORZ, aVisible);
if aVisible then if aVisible or NeedUpdate then
ScrollBarRange(SB_HORZ, aRange, aPage, aPos); ScrollBarRange(SB_HORZ, aRange, aPage, aPos);
end; end;
@ -11673,11 +11676,19 @@ end;
procedure TCustomStringGrid.InsertRowWithValues(Index: Integer; procedure TCustomStringGrid.InsertRowWithValues(Index: Integer;
Values: array of String); Values: array of String);
var var
i, OldRC: Integer; i, OldRC, Diff: Integer;
begin begin
OldRC := RowCount; OldRC := RowCount;
if Length(Values) > ColCount then 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); ColCount := Length(Values);
end;
InsertColRow(false, Index); InsertColRow(false, Index);
//if RowCount was 0, then setting ColCount restores RowCount (from FGridPropBackup) //if RowCount was 0, then setting ColCount restores RowCount (from FGridPropBackup)
//which is unwanted here, so reset it (Issue #0026943) //which is unwanted here, so reset it (Issue #0026943)

View File

@ -272,4 +272,14 @@ begin
FDecimals := 0; FDecimals := 0;
end; 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 // included by spin.pp

View File

@ -99,7 +99,19 @@ function TCustomTaskDialog.ButtonIDToModalResult(const AButtonID: Integer
): TModalResult; ): TModalResult;
begin begin
if AButtonID<100 then 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<Buttons.Count) then else if (AButtonID-100<Buttons.Count) then
Result := Buttons[AButtonID-100].ModalResult Result := Buttons[AButtonID-100].ModalResult
else else

View File

@ -4709,15 +4709,7 @@ begin
else else
begin begin
// do query wincontrol children, in case they overlap // do query wincontrol children, in case they overlap
Control := ControlAtPos(SmallPointToPoint(MouseMessage.Pos), Control := ControlAtPos(SmallPointToPoint(MouseMessage.Pos), []);
[capfAllowWinControls]);
if Control is TWinControl then
begin
// there is a TWinControl child at this position
// TWinControl children get their own messages
// => ignore here
Control := nil;
end;
end; end;
//DebugLn(['TWinControl.IsControlMouseMsg B ',DbgSName(Self),' Control=',DbgSName(Control),' Msg=',TheMessage.Msg]); //DebugLn(['TWinControl.IsControlMouseMsg B ',DbgSName(Self),' Control=',DbgSName(Control),' Msg=',TheMessage.Msg]);

View File

@ -446,7 +446,7 @@ end;
const const
TD_BTNMOD: array[TCommonButton] of Integer = ( TD_BTNMOD: array[TCommonButton] of Integer = (
mrOk, mrYes, mrNo, mrCancel, mrRetry, mrAbort); mrOk, mrYes, mrNo, mrCancel, mrRetry, mrClose);
function TD_BTNS(button: TCommonButton): pointer; function TD_BTNS(button: TCommonButton): pointer;
begin begin

View File

@ -144,6 +144,7 @@ type
procedure SetValue(const AValue: integer); overload; virtual; procedure SetValue(const AValue: integer); overload; virtual;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
function GetLimitedValue(const AValue: Double): Double; override;
public public
property Value: integer read GetValue write SetValue default 0; property Value: integer read GetValue write SetValue default 0;
property MinValue: integer read GetMinValue write SetMinValue default 0; property MinValue: integer read GetMinValue write SetMinValue default 0;