I have a TableGrid it has 5 columns. Column 5 has a checkbox enabled by selecting checkbox under 'settings'.
My intention is to click in cell 5 on a specific row and cause the current date to be entered into cell 4. I then want to change the font color of the row.
I have the code below which partly works, the checkbox appears and the date does get entered into the correct cell.
However, I can click anywhere on the row to get this to happen, what I want is to have just column 5 cell to perform the date function when clicked.
I can't get the row font colour to change at all, though I would be just as happy to have a row grayed out.
procedure frmMain_grdOrders_OnCellClick (Sender: TObject; ACol, ARow: Integer);
var
YY,MM,DD:Word;
begin
DecodeDate(frmMain.DateTimePicker1.DateTime,YY,MM,DD); //get only the date portion of datetime
if frmMain.grdOrders.Cell[5,ARow].Empty = false then //checkbox is unticked
begin
frmMain.grdOrders.Cell[4,ARow].AsDateTime := EncodeDate(YY,MM,DD);
frmMain.grdOrders.font.color:= clGreen;
end;
end;
Any ideas greatfully received.