This forum is temporaily read-only. All existing discussions remain available for reference. For new questions, bug reports or support requests, please contact us at mail@lmdsupport.com.

TElTreeInplaceComboBox: How to colour the cell during processing?

edited October 2013 in LMD ElPack
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

  • 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.