截获Enter键,然后发出Tab健的消息。

解决方案 »

  1.   

    那如何发出tab键的消息?
     请赐教。谢谢。
      

  2.   

      if (key=13) then
        postmessage(handle,wm_nextdlgctl,0,0) ;
      

  3.   

    在keyup事件中加入
      if (key=13) then
        postmessage(handle,wm_nextdlgctl,0,0) ;
      

  4.   

    ValidParentForm(Self).Perform(CM_DialogKey, VK_TAB, 0);
      

  5.   

    KeyPress:=True;Procedure TForm1.FormKeyPress(Sender:Tobject;Var Key:Char);
    begin
    if key=#13 then
    if not (activecontrol is tdbgrid) then
    begin
    key:=#0;
    perform(WM_NEXTDLGCTL,0,0);
    end else
    if (activecontrol is tdbgird) then
    beign
    with tdbgrid(activecontrol) do
    if selectedindex<(fieldcount-1) then
    selectedindex:=selectedindex+1
    else selectedindex:=0;
    end;
    end;
      

  6.   

    在控件的OnKeyDown事件中写入
      if Key = 13 then
        SelectNext(ActiveControl,True,True);
      

  7.   

    如果你只是要使focus下移的话,这样比较简单
    Procedure TForm1.FormKeyPress(Sender:Tobject;Var Key:Char);
    Begin
     if Key = #13 then
        SelectNext(ActiveControl, true, true);
    end
      

  8.   

    谢谢大家帮助我,但分值有限,只能小小表示一下,不好意思。
    还有 语句 if key=13 是不是应为  if key=chr(13)?