stringgrid变化就意味着要重画!
onDrawCell

解决方案 »

  1.   

    onDrawCell时和原Cell[i,j]值比较作判断
      

  2.   

    OnSetEditText occurs every time the user changes the text.type TSetEditEvent = procedure (Sender: TObject; ACol, ARow: Longint; const Value: String) of object;
    property OnSetEditText: TSetEditEvent;响应它吧。
      

  3.   

    agui 大虾,请问你这个属性怎么使用啊,还有read,write域呢?请在指教!
      

  4.   

    请再问,我如何利用onsetedittext来实现opendialog和savedialog的"打开"与"保存"事件呢?
    还有在我的"新建 "(newclick)事件中,我又怎知道或如何判断cells的内容的改变呢.
    可否给一个具体的实列呢
      

  5.   

    再请问大虾,我如何可以实现用onsetedittext来实现opendialog和savedialog的"打开"和"保存"事件呢?
    还有,我的"新建"事件(newclick)中,怎样判断cells的内容改变,以便作新存贮.
    可否给我一个这方面的实列---非常感谢!!
      

  6.   

    察看TCustomGrid的以下几个方法:
    function GetEditText(ACol, ARow: Longint): string; dynamic;
    procedure SetEditText(ACol, ARow: Longint; const Value: string); dynamic;
    等等等等。最好查一查“FInplaceEditor”相关的方法。
    然后自己写一个类重载他
      

  7.   

    我又看了一下,好像用OnGetEditText这个事件就行了
      

  8.   

    数字蛋糕大虾:我用了ongetedittext事件可是在程序执行中,却没有执行其中的内容
    请问是怎么回事啊?
    我的程序如下:一个stringgrid,opendialog和savedialog组件;
    procedure TForm1.StringGrid1GetEditText(Sender: TObject; ACol,
      ARow: Integer; var Value: String);
    begin
       savedialog1.execute;
      if savedialog1.Execute and ( messagedlg('save file?',mtconfirmation,mbYesNoCancel,0)=mrYes)then
          form2.show;
    end;form2的程序为:unit openandsaveu2;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls;type
      TForm2 = class(TForm)
        Label1: TLabel;
        Edit1: TEdit;
        Label2: TLabel;
        Edit2: TEdit;
        Button1: TButton;
        Button2: TButton;
        procedure Button1Click(Sender: TObject);
        //procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form2: TForm2;implementationuses openandsaveu;{$R *.DFM}procedure TForm2.Button1Click(Sender: TObject);
    var
      i,j,k,lineNo:integer;
      atextfile:system.text;
      textLine:string;
    begin
      i:=strtoint(edit1.text);
      j:=strtoint(edit2.text);  with form1 do
        begin  ////
          if savedialog1.execute then
            begin
              assignfile(atextfile,savedialog1.filename);
              rewrite(atextfile);
              for k:=i to j do
                begin
                   textline:=stringgrid1.cells[1,k];
                   writeln(atextfile,textline);
                end;
              closefile(atextfile);
            end;
        end;/////end;end.请指点指点!!