我想在stringgrid中离开单元格时操作一些事情
包括从一格移到另一格或者焦点
从STRINGGRID移到其他组件从STRINGGRID移到其他组件用EXIT就可以
那么从一格移到另一格呢?

解决方案 »

  1.   

    stringgrid没有这样的事件,你自己写一个过程截获stringgrid.onenter事件:
    public 
     procedure appmsg(var msg:tagmsg;var handled :boolean);
     procedure myprocedure (sender:object);
    end;
    var 
     form1:tform1;
    implementationprocedure tform1.formcreate(sender:object);
    begin
     application.onmessage:=appmsg;
    end;
    procedure tform1.appmsg(var msg:tagmsg;var handled :boolean);
    begin
      stringgrid1.onenter:=myprocedure;
    end;
    procedure tform1.myprocedure;
    begin
    .......
    .......
    end;
      

  2.   

    使用OnSetEditText事件就行了。如
    procedure TForm1.StringGrid1SetEditText(Sender: TObject; ACol,
      ARow: Integer; const Value: String);
    begin
      if (ACol = 1) and (ARow =1) then ShowMessage(Value);
    end;—————————————————————————————————
    宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
    —————————————————————————————————