mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-14 18:12:05 +08:00
Apply correct background color to grideditors (inplace + datetime), for cases where columns are sorted and have a gray background.
This commit is contained in:
@ -17,6 +17,7 @@ type
|
|||||||
FColumn: TColumnIndex; // The column of the node.
|
FColumn: TColumnIndex; // The column of the node.
|
||||||
FCellText: WideString; // Original cell text value
|
FCellText: WideString; // Original cell text value
|
||||||
FCellFont: TFont; // Cosmetic
|
FCellFont: TFont; // Cosmetic
|
||||||
|
FCellBackground: TColor;
|
||||||
FMainControl: TWinControl; // The editor's most important component
|
FMainControl: TWinControl; // The editor's most important component
|
||||||
FStopping: Boolean; // Set to True when the edit link requests stopping the edit action.
|
FStopping: Boolean; // Set to True when the edit link requests stopping the edit action.
|
||||||
FLastKeyDown: Integer; // Set in OnKeyDown on the editor's main control
|
FLastKeyDown: Integer; // Set in OnKeyDown on the editor's main control
|
||||||
@ -221,6 +222,7 @@ begin
|
|||||||
FCellFont := TFont.Create;
|
FCellFont := TFont.Create;
|
||||||
FTree.GetTextInfo(FNode, FColumn, FCellFont, FCellTextBounds, FCellText);
|
FTree.GetTextInfo(FNode, FColumn, FCellFont, FCellTextBounds, FCellText);
|
||||||
FCellFont.Color := DatatypeCategories[Integer(Datatypes[Integer(Datatype)].Category)].Color;
|
FCellFont.Color := DatatypeCategories[Integer(Datatypes[Integer(Datatype)].Category)].Color;
|
||||||
|
FCellBackground := FTree.Header.Columns[FColumn].Color;
|
||||||
if Assigned(FMainControl) then begin
|
if Assigned(FMainControl) then begin
|
||||||
FOldWindowProc := FMainControl.WindowProc;
|
FOldWindowProc := FMainControl.WindowProc;
|
||||||
FMainControl.WindowProc := TempWindowProc;
|
FMainControl.WindowProc := TempWindowProc;
|
||||||
@ -383,12 +385,12 @@ begin
|
|||||||
FPanel.Parent := FParentForm;
|
FPanel.Parent := FParentForm;
|
||||||
FPanel.Hide;
|
FPanel.Hide;
|
||||||
FPanel.ParentBackground := False;
|
FPanel.ParentBackground := False;
|
||||||
FPanel.Color := FTree.Color;
|
|
||||||
FPanel.BevelOuter := bvNone;
|
FPanel.BevelOuter := bvNone;
|
||||||
FPanel.OnExit := DoEndEdit;
|
FPanel.OnExit := DoEndEdit;
|
||||||
|
|
||||||
FMaskEdit := TMaskEdit.Create(FPanel);
|
FMaskEdit := TMaskEdit.Create(FPanel);
|
||||||
FMaskEdit.Parent := FPanel;
|
FMaskEdit.Parent := FPanel;
|
||||||
|
FMaskEdit.ParentColor := True;
|
||||||
FMaskEdit.BorderStyle := bsNone;
|
FMaskEdit.BorderStyle := bsNone;
|
||||||
FMaskEdit.OnKeyDown := DoKeyDown;
|
FMaskEdit.OnKeyDown := DoKeyDown;
|
||||||
FMaskEdit.OnKeyUp := DoKeyUp;
|
FMaskEdit.OnKeyUp := DoKeyUp;
|
||||||
@ -459,6 +461,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
FMaskEdit.Text := CellText;
|
FMaskEdit.Text := CellText;
|
||||||
FMaskEdit.Font.Assign(FCellFont);
|
FMaskEdit.Font.Assign(FCellFont);
|
||||||
|
FPanel.Color := FCellBackground;
|
||||||
// Auto-enlarge current tree column so the text in the edit is not cut
|
// Auto-enlarge current tree column so the text in the edit is not cut
|
||||||
MinColWidth := FTree.Canvas.TextWidth(CellText) + FTree.TextMargin + FUpDown.Width + 5;
|
MinColWidth := FTree.Canvas.TextWidth(CellText) + FTree.TextMargin + FUpDown.Width + 5;
|
||||||
if FTree.Header.Columns[FColumn].Width < MinColWidth then
|
if FTree.Header.Columns[FColumn].Width < MinColWidth then
|
||||||
@ -791,12 +794,12 @@ begin
|
|||||||
FPanel.Parent := FParentForm;
|
FPanel.Parent := FParentForm;
|
||||||
FPanel.Hide;
|
FPanel.Hide;
|
||||||
FPanel.ParentBackground := False;
|
FPanel.ParentBackground := False;
|
||||||
FPanel.Color := FTree.Color;
|
|
||||||
FPanel.BevelOuter := bvNone;
|
FPanel.BevelOuter := bvNone;
|
||||||
FPanel.OnExit := DoEndEdit;
|
FPanel.OnExit := DoEndEdit;
|
||||||
|
|
||||||
FEdit := TTntEdit.Create(FPanel);
|
FEdit := TTntEdit.Create(FPanel);
|
||||||
FEdit.Parent := FPanel;
|
FEdit.Parent := FPanel;
|
||||||
|
FEdit.ParentColor := True;
|
||||||
FEdit.BorderStyle := bsNone;
|
FEdit.BorderStyle := bsNone;
|
||||||
FEdit.OnKeyDown := DoKeyDown;
|
FEdit.OnKeyDown := DoKeyDown;
|
||||||
FMainControl := FEdit;
|
FMainControl := FEdit;
|
||||||
@ -881,6 +884,7 @@ begin
|
|||||||
|
|
||||||
FEdit.Font.Assign(FCellFont);
|
FEdit.Font.Assign(FCellFont);
|
||||||
FEdit.Font.Color := clWindowText;
|
FEdit.Font.Color := clWindowText;
|
||||||
|
FPanel.Color := FCellBackground;
|
||||||
if ScanNulChar(FCellText) then begin
|
if ScanNulChar(FCellText) then begin
|
||||||
MessageDlg(SContainsNulCharGrid, mtInformation, [mbOK], 0);
|
MessageDlg(SContainsNulCharGrid, mtInformation, [mbOK], 0);
|
||||||
FEdit.Text := RemoveNulChars(FCellText);
|
FEdit.Text := RemoveNulChars(FCellText);
|
||||||
|
Reference in New Issue
Block a user