Following is the sample:
  if (Sender is TDBEdit) or (Sender is TFetchDBEdit) then
     With TFetchDBEdit(Sender) do
     begin
       if not (DataSource.Dataset.State in [dsinsert,dsEdit]) then exit;
       if DataSource.Dataset.FindField(DataField) is TStringField then
       begin
         if Length(Text) = DataSource.Dataset.FindField(DataField).Size then
           SelectNext(TWincontrol(Sender),True,True);
       end;
     end;三少 :o)

解决方案 »

  1.   

    1.再清楚一点儿
    2.DBnavigator跟一个Tabel关联起来就可以了。
      

  2.   

    就是用语句实现,例如DBnavigator1.delete.....当然这是没有的,不过想必能够清楚的表达我的意思吧。
      

  3.   

    就是用语句实现,例如DBnavigator1.delete.....当然这是没有的,不过想必能够清楚的表达我的意思吧。
      

  4.   

    既然这样为什么要用它?直接table.next....delete不行了
    一定要用调用它的click.
      

  5.   

    我连的table在另一个窗体中,不能直接调用....
    click之后再怎样呢,请说详细点。
      

  6.   

    1.需要对一批相同组件同时操作。
    可以将它们相同的事件定在一个事件中,如
    edit1.Onkeydown=mykeydown;
    edit2.onkeydown=mykeydown;
    然后再在mykeydown中识别是哪个edit1.
    procedure TForm1.MyKeyDown(Sender as TObject)
    var ControlName:string;
    begin
      ControlName:=(Sender as TEdit).Name;
      //注意分大小写。 
      if ControlName='Edit1' then
      begin
      ...
      end
      else if ControlName='Edit2' then 
      begin
       ...
      end; 
    end;
    2.怎样在程序中利用TDBnavigator执行各种数据库操作。
    指定它的DataSource 
    var DataSource:TDataSource;
    procedure TForm1.Oncreate;
    begin
      DataSource:=TDataSource.Create(self);
      DataSource.DataSet:=哪个窗体的DataSet(Table,Query);
      DBnavigator1.DataSource:=DataSource;
    end;
      

  7.   

    谢谢各位,第一个问题我已经解决了,就是用actionlist组件将所有操作打包。
    而第二个问题,难道我说的还不够清楚,再说一遍吧....不是指执行.exe后对TDBnavigator操作,而是,!!!!!!注意,是在我的程序代码中使用它完成insert,delete等等操作。TDBnavigator与数据库的连接正常。
      

  8.   

    kami
    即然连接正常,那么就像其它控件对数据库的操作一样,它的操作就是对数据库insert,delete,
    都不用你写代码了
    我想你的意思是想控制TDBnavigator中各个小button的功能,或是用自己的代码替代它吧
      

  9.   

    procedure TForm1.DBNavigator1Click(Sender: TObject; Button: TNavigateBtn);
    begin
       case button of
         nbFirst:   // Go to the first record
         nbPrior:   // Go to the previous record
         nbNext:    // Go to the next record
         nbLast:    // Go to the last record
         nbInsert:  // Insert a blank record
         nbDelete:  // Delete the current record
         nbEdit:    // Permit users to edit the current record
         nbPost :   // Post the current record
         nbCancel:  // Cancel the current edit
         nbRefresh: //
      end;
    end;
      

  10.   

    感谢各位的回答,但是......
    .......
    .......
    我的意思是
    比如说:用户打开了一张表,而我要在程序中控制当这张表打开之后执行一次insert操作,而当前窗体中只有一个tnavigator(不可见,即不是给用户使用的),我该怎样做?
      

  11.   

    最本的方法:
    把tnavigator放在窗体外,并非不可见! 然后就是click啦!