Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TAdvStringGrid
Use a different inplace editor color than the cell color

Normally, the inplace edit control gets the same color as the cell color. Sometimes this behaviour is not wanted, especially when the cell that is edited must be highlighted. This can be down in the following way :
procedure TForm1.FormCreate(Sender: TObject);
begin
  AdvStringGrid1.Color := clSilver;
end;

procedure TForm1.AdvStringGrid1GetCellColor(Sender: TObject; ARow,
ACol: Integer; AState: TGridDrawState; ABrush: TBrush; AFont: TFont);
begin
  if (acol = AdvStringGrid1.Col) and
     (arow = AdvStringGrid1.Row) then
  begin
    if Assigned(AdvStringGrid1.NormalEdit) then
    if (AdvStringGrid1.NormalEdit.Visible) then
    ABrush.Color := clWhite;
  end;
end;