Hi again,
Does anybody know how to change the cell font if user edits the cell. I cannot find font properties in edit mode similar to those in other property categories.
Probably someone has a clue for this?
thank you in advance for your help!
change font of cell when editing
Re: change font of cell when editing
Found it - very easy! This is a code snippet which copies all cell font settings equally to the column properties:
Code: Select all
procedure TMainForm.TeeGridCellEditing(const Sender: TObject;
const AEditor: TControl; const AColumn: TColumn; const ARow: Integer);
begin
if Assigned(AEditor) then begin
(AEditor as TEdit).StyledSettings := [];
// copy cell style)
case AColumn.TextAlign.Horizontal of
THorizontalAlign.Left: (AEditor as TEdit).TextSettings.HorzAlign := TTextAlign.Leading;
THorizontalAlign.Center: (AEditor as TEdit).TextSettings.HorzAlign := TTextAlign.Center;
THorizontalAlign.Right: (AEditor as TEdit).TextSettings.HorzAlign := TTextAlign.Trailing;
end;
case AColumn.TextAlign.Vertical of
TVerticalAlign.Top: (AEditor as TEdit).TextSettings.VertAlign := TTextAlign.Leading;
TVerticalAlign.Center: (AEditor as TEdit).TextSettings.VertAlign := TTextAlign.Center;
TVerticalAlign.Bottom: (AEditor as TEdit).TextSettings.VertAlign := TTextAlign.Trailing;
end;
(AEditor as TEdit).Font.Size := AColumn.Format.Font.Size;
(AEditor as TEdit).FontColor := GRIDCOLOR_FLEX_COLUMN_EDIT;
(AEditor as TEdit).Font.Style := [TFontStyle.fsBold];
end;
end;