Hi,
I have a grid with 2 columns:
column A with a combobox
column B with a text
Depending on combobox A selection, column B has grey or white color (brush color)
Colors are set using GetCellColor event.
What I want:
after selecting an item in my combobox, the cell color of column B must change
What's happening
after selecting an item in my combobox, the GetCellColor is fired correctly, but the "Cells" function is returning the "old" combobox value. (example: Item1 is selected on combox >> I select Item2 >> in the GetCellColor event the Cells function is returning "Item1" >> If I clic another time on Item2, this time Cells returns "Item2"
My ComboChange event:
procedure XXX.gridDataComboChange(Sender: TObject; ACol, ARow, AItemIndex: Integer; ASelection: string);
begin
if (ARow > 0) then
begin
// Force cell repainting
gridData.RepaintCell(colB, ARow);
end; {if}
end;
My GetCellColor event
procedure XXX.gridDataGetCellColor(Sender: TObject; ARow,
ACol: Integer; AState: TGridDrawState; ABrush: TBrush; AFont: TFont);
begin
if (ARow > 0) and (ACol = ColB) then
begin
if (gridData.Cells[colA, ARow] = 'Item 1') then
begin
ABrush.Color:= gridData.Color;
end;
if (gridData.Cells[colA, ARow] = 'Item 2') then
begin
ABrush.Color:= clGray;
end;
end; {if}
end;
I hope I have explained my issue.
Thanks
Claudio Basso