TopGrid usage
- From: MikeR <nf4l@xxxxxxxxx>
- Date: Fri, 13 Jan 2006 19:35:13 -0500
I have a 2 column tsGrid. The first column has a TtsDateTimeDef. I need to clear the date from the cell programatically. The below code does not do it.
I also tried setting the row in question to selected and doing a DeleteSelectedRows, which also did not clear the cell holding the date. Please, no suggestions for a different grid component.
Thanks,
MikeR
procedure TfrmSetup.tsGridAlarmCellEdit(Sender: TObject; DataCol,
DataRow: Integer; ByUser: Boolean);
var
i: integer;
s1,s2:string;
begin
for i := 1 to tsGridAlarm.Rows do
begin
if (tsGridAlarm.Cell[1,i] = tsGridAlarm.Cell[1,DataRow]) and
(length(tsGridAlarm.Cell[1,i]) > 0 ) and (i <> DataRow) then
begin
MessageDlg('Cannot have multiple events on the same date.', mtInformation,[mbOK],0);
s1 := tsGridAlarm.Cell[1,DataRow]; <<<=== contains 1/19/2006
tsGridAlarm.Cell[1,DataRow] := '';
tsGridAlarm.DeleteRows(DataRow,DataRow);
//or tsGridAlarm.RowSelected[DataRow] := true;
// tsGridAlarm.DeleteSelectedRows;
tsGridAlarm.RefreshData(roBoth,rpNone);
s2 := tsGridAlarm.Cell[1,DataRow]; <<<=== blank (but the cell displays the date)
end;
end;
tsGridAlarm.Rows := 20;
end;This works: procedure TfrmSetup.btnAlarmDeleteClick(Sender: TObject); begin tsGridAlarm.DeleteSelectedRows; end; .
- Follow-Ups:
- Re: TopGrid usage
- From: MikeR
- Re: TopGrid usage
- From: Paul Dolen
- Re: TopGrid usage
- Prev by Date: Re: ESBRaveViewer v3.0 - Free Rave NDR Viewer
- Next by Date: Re: OFX file parser
- Previous by thread: OFX file parser
- Next by thread: Re: TopGrid usage
- Index(es):