Dano
Dano

Reputation: 667

In a devexpress tdxdbgrid, is there a way to allow rowselect and keypress events to both fire?

Client would like to have row selected so that he can tell what record on the left is being worked on, while being able to edit just 1 column.

so, advise on how to allow row-select plus keypress events to fire, or how to color a cell based on whether another cell in it's row has been entered.

Upvotes: 0

Views: 1465

Answers (1)

Mihaela
Mihaela

Reputation: 2502

Coloring distinct cxGrid rows is best done using their Styles collection with OnGetContentStyle event.

procedure StylesGetContentStyle(Sender: TcxCustomGridTableView;
  ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem;
  out AStyle: TcxStyle);  
begin    
  if SomeCondition then
    AStyle := SomeTcxStyle;  
end;

Another way is by using OnCustomDrawCell event and drawing the grid yourself. I prefer to use styles, it's cleaner.

Upvotes: 3

Related Questions