mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 19:19:18 +02:00
LCL: grids: fix default editor placement and cell background. Issue #29196. Modified patch by abonic1
git-svn-id: trunk@50847 -
This commit is contained in:
parent
85b4906f28
commit
9cd8314204
@ -3567,7 +3567,10 @@ begin
|
|||||||
Canvas.Pen.Mode := pmCopy;
|
Canvas.Pen.Mode := pmCopy;
|
||||||
GetSelectedState(aState, IsSelected);
|
GetSelectedState(aState, IsSelected);
|
||||||
if IsSelected then begin
|
if IsSelected then begin
|
||||||
Canvas.Brush.Color := SelectedColor;
|
if FEditorMode and (FEditor<>nil) then
|
||||||
|
Canvas.Brush.Color := FEditor.Color
|
||||||
|
else
|
||||||
|
Canvas.Brush.Color := SelectedColor;
|
||||||
SetCanvasFont(GetColumnFont(aCol, False));
|
SetCanvasFont(GetColumnFont(aCol, False));
|
||||||
if not IsCellButtonColumn(point(aCol,aRow)) then
|
if not IsCellButtonColumn(point(aCol,aRow)) then
|
||||||
Canvas.Font.Color := clHighlightText;
|
Canvas.Font.Color := clHighlightText;
|
||||||
@ -7831,6 +7834,7 @@ procedure TCustomGrid.EditorPos;
|
|||||||
var
|
var
|
||||||
msg: TGridMessage;
|
msg: TGridMessage;
|
||||||
CellR: TRect;
|
CellR: TRect;
|
||||||
|
EditorTop: integer;
|
||||||
begin
|
begin
|
||||||
{$ifdef dbgGrid} DebugLn('Grid.EditorPos INIT');{$endif}
|
{$ifdef dbgGrid} DebugLn('Grid.EditorPos INIT');{$endif}
|
||||||
if FEditor<>nil then begin
|
if FEditor<>nil then begin
|
||||||
@ -7855,8 +7859,21 @@ begin
|
|||||||
CellR := Bounds(-FEditor.Width-100, -FEditor.Height-100, CellR.Right-CellR.Left, CellR.Bottom-CellR.Top);
|
CellR := Bounds(-FEditor.Width-100, -FEditor.Height-100, CellR.Right-CellR.Left, CellR.Bottom-CellR.Top);
|
||||||
|
|
||||||
if FEditorOptions and EO_AUTOSIZE = EO_AUTOSIZE then begin
|
if FEditorOptions and EO_AUTOSIZE = EO_AUTOSIZE then begin
|
||||||
if EditorBorderStyle = bsNone then
|
if EditorBorderStyle = bsNone then begin
|
||||||
InflateRect(CellR, -1, -1);
|
Inc(CellR.Left); // << to have the correct Y-coordinate: Gtk2 needs Inc; Qt+Win32 require no Inc; << some WS-dependent fix needed
|
||||||
|
Dec(CellR.Right);
|
||||||
|
Dec(CellR.Bottom);
|
||||||
|
if (FEditor = FStringEditor) then begin
|
||||||
|
FEditor.Height := Canvas.TextHeight(' ');
|
||||||
|
case GetColumnLayout(FCol, False) of
|
||||||
|
tlTop: EditorTop:=CellR.Top+constCellPadding;
|
||||||
|
tlCenter: EditorTop:=CellR.Top+(CellR.Bottom-CellR.Top-FEditor.Height) div 2;
|
||||||
|
tlBottom: EditorTop:=CellR.Bottom-constCellPadding-FEditor.Height+1;
|
||||||
|
end;
|
||||||
|
if EditorTop>CellR.Top then CellR.Top:=EditorTop;
|
||||||
|
CellR.Bottom:=CellR.Top+FEditor.Height;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
FEditor.BoundsRect := CellR;
|
FEditor.BoundsRect := CellR;
|
||||||
end else begin
|
end else begin
|
||||||
Msg.LclMsg.msg:=GM_SETBOUNDS;
|
Msg.LclMsg.msg:=GM_SETBOUNDS;
|
||||||
|
Loading…
Reference in New Issue
Block a user