一个stringgrid 在读取数据后,显示给用户,接下来,用户可能修改其中的某些行的内容,如何知道究竟哪些行被修改了呢?谢谢。

解决方案 »

  1.   

    //参考如下代码
    var
      vGetText: string;procedure TForm1.StringGrid1SetEditText(Sender: TObject; ACol,
      ARow: Integer; const Value: String);
    begin
      if vGetText <> Value then
        Caption := Format('Time:%s,Row:%d,Value:%s',
          [TimeToStr(Time), ARow, Value]);
    end;procedure TForm1.StringGrid1GetEditText(Sender: TObject; ACol,
      ARow: Integer; var Value: String);
    begin
      vGetText := Value;
    end;
      

  2.   

    在事件代码里打日志,原始的方法最管用
    procedure TForm1.StringGrid1GetEditText(Sender: TObject; ACol,
      ARow: Integer; var Value: String);
    begin
      Memo1.Lines.Add('TForm1.StringGrid1GetEditText');
    end;
      

  3.   

    控件的某些属性设置,有时会对事件的发生产生影响。如:OnGetEditText does not occur unless the Options property includes goEditing.我想看看这方面比较详细的介绍。