mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 16:09:41 +02:00
grids, fixed column resizing bug issues #10664,#10659
git-svn-id: trunk@13811 -
This commit is contained in:
parent
160f3905c4
commit
b512ff2787
@ -687,6 +687,7 @@ type
|
|||||||
procedure UpdateScrollBarPos(Which: TScrollStyle);
|
procedure UpdateScrollBarPos(Which: TScrollStyle);
|
||||||
procedure UpdateCachedSizes;
|
procedure UpdateCachedSizes;
|
||||||
procedure UpdateSBVisibility;
|
procedure UpdateSBVisibility;
|
||||||
|
procedure UpdateSizes;
|
||||||
procedure WriteColumns(Writer: TWriter);
|
procedure WriteColumns(Writer: TWriter);
|
||||||
procedure WriteColWidths(Writer: TWriter);
|
procedure WriteColWidths(Writer: TWriter);
|
||||||
procedure WriteRowHeights(Writer: TWriter);
|
procedure WriteRowHeights(Writer: TWriter);
|
||||||
@ -1768,12 +1769,29 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomGrid.InternalSetColWidths(aCol, aValue: Integer);
|
procedure TCustomGrid.InternalSetColWidths(aCol, aValue: Integer);
|
||||||
|
var
|
||||||
|
R: TRect;
|
||||||
|
Bigger: boolean;
|
||||||
begin
|
begin
|
||||||
if AValue<0 then Avalue:=-1;
|
if AValue<0 then Avalue:=-1;
|
||||||
if Avalue<>integer(PtrUInt(FCols[ACol])) then begin
|
if Avalue<>integer(PtrUInt(FCols[ACol])) then begin
|
||||||
|
Bigger := AValue>integer(PtrUInt(FCols[ACol]));
|
||||||
SetRawColWidths(ACol, Avalue);
|
SetRawColWidths(ACol, Avalue);
|
||||||
if not (csLoading in ComponentState) then begin
|
if not (csLoading in ComponentState) then begin
|
||||||
VisualChange;
|
|
||||||
|
UpdateSizes;
|
||||||
|
|
||||||
|
R := CellRect(aCol, 0);
|
||||||
|
R.Bottom := FGCache.MaxClientXY.Y+GetBorderWidth+1;
|
||||||
|
if bigger then
|
||||||
|
R.Right := FGCache.MaxClientXY.X+GetBorderWidth+1
|
||||||
|
else
|
||||||
|
R.Right := FGCache.ClientWidth;
|
||||||
|
if aCol=FTopLeft.x then
|
||||||
|
R.Left := FGCache.FixedWidth;
|
||||||
|
|
||||||
|
InvalidateRect(handle, @R, False);
|
||||||
|
|
||||||
if (FEditor<>nil)and(Feditor.Visible)and(ACol<=FCol) then
|
if (FEditor<>nil)and(Feditor.Visible)and(ACol<=FCol) then
|
||||||
EditorWidthChanged(aCol, aValue);
|
EditorWidthChanged(aCol, aValue);
|
||||||
ColWidthsChanged;
|
ColWidthsChanged;
|
||||||
@ -2030,11 +2048,30 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomGrid.Setrowheights(Arow: Integer; Avalue: Integer);
|
procedure TCustomGrid.Setrowheights(Arow: Integer; Avalue: Integer);
|
||||||
|
var
|
||||||
|
R: TRect;
|
||||||
|
Bigger: boolean;
|
||||||
begin
|
begin
|
||||||
if AValue<0 then AValue:=-1;
|
if AValue<0 then AValue:=-1;
|
||||||
if AValue<>integer(PtrUInt(FRows[ARow])) then begin
|
if AValue<>integer(PtrUInt(FRows[ARow])) then begin
|
||||||
|
|
||||||
|
bigger := aValue > RowHeights[aRow];
|
||||||
|
|
||||||
FRows[ARow]:=Pointer(PtrInt(AValue));
|
FRows[ARow]:=Pointer(PtrInt(AValue));
|
||||||
VisualChange;
|
|
||||||
|
UpdateSizes;
|
||||||
|
|
||||||
|
R := CellRect(0, aRow);
|
||||||
|
R.Right := FGCache.MaxClientXY.X+GetBorderWidth+1;
|
||||||
|
if bigger then
|
||||||
|
R.Bottom := FGCache.MaxClientXY.Y+GetBorderWidth+1
|
||||||
|
else
|
||||||
|
R.Bottom := FGCache.ClientHeight;
|
||||||
|
if aRow=FTopLeft.y then
|
||||||
|
R.Top := FGCache.FixedHeight;
|
||||||
|
|
||||||
|
InvalidateRect(handle, @R, False);
|
||||||
|
|
||||||
if (FEditor<>nil)and(Feditor.Visible)and(ARow<=FRow) then EditorPos;
|
if (FEditor<>nil)and(Feditor.Visible)and(ARow<=FRow) then EditorPos;
|
||||||
RowHeightsChanged;
|
RowHeightsChanged;
|
||||||
end;
|
end;
|
||||||
@ -2304,10 +2341,7 @@ begin
|
|||||||
if FUpdateCount<>0 then
|
if FUpdateCount<>0 then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
Include(FGridFlags, gfVisualChange);
|
UpdateSizes;
|
||||||
UpdateCachedSizes;
|
|
||||||
|
|
||||||
UpdateSBVisibility;
|
|
||||||
|
|
||||||
Invalidate;
|
Invalidate;
|
||||||
{$ifdef DbgVisualChange}
|
{$ifdef DbgVisualChange}
|
||||||
@ -2805,49 +2839,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomGrid.ResizeColumn(aCol, aWidth: Integer);
|
procedure TCustomGrid.ResizeColumn(aCol, aWidth: Integer);
|
||||||
var
|
|
||||||
R: TRect;
|
|
||||||
bigger: boolean;
|
|
||||||
begin
|
begin
|
||||||
BeginUpdate;
|
if aWidth<0 then
|
||||||
if aWidth<0 then aWidth:=0;
|
aWidth:=0;
|
||||||
bigger := aWidth > ColWidths[aCol];
|
ColWidths[aCol] := aWidth;
|
||||||
ColWidths[aCol]:=aWidth;
|
|
||||||
EndUpdate(uoNone);
|
|
||||||
|
|
||||||
R := CellRect(aCol, 0);
|
|
||||||
R.Bottom := FGCache.MaxClientXY.Y+GetBorderWidth+1;
|
|
||||||
if bigger then
|
|
||||||
R.Right := FGCache.MaxClientXY.X+GetBorderWidth+1
|
|
||||||
else
|
|
||||||
R.Right := FGCache.ClientWidth;
|
|
||||||
if aCol=FTopLeft.x then
|
|
||||||
R.Left := FGCache.FixedWidth;
|
|
||||||
|
|
||||||
InvalidateRect(handle, @R, False);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomGrid.ResizeRow(aRow, aHeight: Integer);
|
procedure TCustomGrid.ResizeRow(aRow, aHeight: Integer);
|
||||||
var
|
|
||||||
R: TRect;
|
|
||||||
bigger: boolean;
|
|
||||||
begin
|
begin
|
||||||
BeginUpdate;
|
if aHeight<0 then
|
||||||
if aHeight<0 then aHeight:=0;
|
aHeight:=0;
|
||||||
bigger := aHeight > RowHeights[aRow];
|
|
||||||
RowHeights[aRow] := aHeight;
|
RowHeights[aRow] := aHeight;
|
||||||
EndUpdate(uoNone);
|
|
||||||
|
|
||||||
R := CellRect(0, aRow);
|
|
||||||
R.Right := FGCache.MaxClientXY.X+GetBorderWidth+1;
|
|
||||||
if bigger then
|
|
||||||
R.Bottom := FGCache.MaxClientXY.Y+GetBorderWidth+1
|
|
||||||
else
|
|
||||||
R.Bottom := FGCache.ClientHeight;
|
|
||||||
if aRow=FTopLeft.y then
|
|
||||||
R.Top := FGCache.FixedHeight;
|
|
||||||
|
|
||||||
InvalidateRect(handle, @R, False);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -3638,6 +3640,13 @@ begin
|
|||||||
ScrollBarShow(SB_HORZ, HSbVisible);
|
ScrollBarShow(SB_HORZ, HSbVisible);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomGrid.UpdateSizes;
|
||||||
|
begin
|
||||||
|
Include(FGridFlags, gfVisualChange);
|
||||||
|
UpdateCachedSizes;
|
||||||
|
UpdateSBVisibility;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomGrid.UpdateSelectionRange;
|
procedure TCustomGrid.UpdateSelectionRange;
|
||||||
begin
|
begin
|
||||||
if goRowSelect in Options then begin
|
if goRowSelect in Options then begin
|
||||||
|
Loading…
Reference in New Issue
Block a user