lcl: dbgrids: adapt after r54816 #43e271b439. Issue #31765 and #31715

git-svn-id: trunk@54842 -
This commit is contained in:
ondrej 2017-05-08 21:37:25 +00:00
parent 5fc40612bc
commit 2abbee1637

View File

@ -1447,13 +1447,13 @@ end;
function TCustomDBGrid.DefaultFieldColWidth(F: TField): Integer; function TCustomDBGrid.DefaultFieldColWidth(F: TField): Integer;
begin begin
if not HandleAllocated or (F=nil) then if not HandleAllocated or (F=nil) then
result:=DefaultColWidth result:=GetRealDefaultColWidth
else begin else begin
if F.DisplayWidth = 0 then if F.DisplayWidth = 0 then
if Canvas.HandleAllocated then if Canvas.HandleAllocated then
result := Canvas.TextWidth( F.DisplayName ) + 3 result := Canvas.TextWidth( F.DisplayName ) + 3
else else
Result := DefaultColWidth Result := GetRealDefaultColWidth
else else
result := F.DisplayWidth * CalcCanvasCharWidth(Canvas); result := F.DisplayWidth * CalcCanvasCharWidth(Canvas);
end; end;
@ -1610,7 +1610,7 @@ begin
{$ifdef dbgDBGrid} {$ifdef dbgDBGrid}
DebugLn('%s.GetBufferCount', [ClassName]); DebugLn('%s.GetBufferCount', [ClassName]);
{$endif} {$endif}
Result := ClientHeight div DefaultRowHeight; Result := ClientHeight div GetRealDefaultRowHeight;
if dgTitles in Options then if dgTitles in Options then
Dec(Result, 1); Dec(Result, 1);
end; end;
@ -4249,7 +4249,7 @@ begin
FreeWorkingCanvas(tmpCanvas); FreeWorkingCanvas(tmpCanvas);
end else end else
result := DEFCOLWIDTH; result := -1;
end; end;
function TColumn.CreateTitle: TGridColumnTitle; function TColumn.CreateTitle: TGridColumnTitle;