Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

TElTreeInplaceComboBox: How to colour the cell during processing?

I have tried:

  InplaceCB.Editor.OnChange  := InplaceCBEditorChange;

procedure TMainForm.InplaceCBEditorChange(Sender: TObject);
begin
  with ItemTree.ItemFocused.Cells[INDEX_Group] do
  begin
    if InplaceCB.Items.IndexOf(InplaceCB.Editor.Text) >= 0 then
    begin
      UseOwnStyle := False;
    end
    else
    begin
      UseOwnStyle := True;

      with Style do
      begin
        TextAlignment       := taLeftJustify;

        ParentColors        := False;
        UseBackGroundColor  := True;

        CellBackGroundColor := ColourOrchid2;
      end;
    end;
  end;
end;

but that only colours the cell after exiting the cell.

I have tried

  InplaceCB.Editor.OnKeyDown := InplaceCBEditorKeyDown;

with exactly the same code, but that does not change the background colour.

The latter Notify Event is called and the code is executed, but the colour does not change.

How is this to be done?

Thanks.
Raymond

Comments

  • 2 Comments sorted by Votes Date Added
  • Hi,

    when a cell is currently edited, the color is defined by the current editor. Not the cell properties.

    Example:
    In BeforeOperation connect KeyDown event of editor control:
    (Sender as TElTreeInplaceComboBox).Editor.OnKeyDown :=  ElHTMLComboBox1KeyDown;

    For event use:
    procedure TForm1.ElHTMLComboBox1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
       TElHTMLComboBox(Sender).Color := clRed;
    end;


Sign In or Register to comment.