quarta-feira, 17 de junho de 2009

Enter funcionando como tab em toda a aplicação

Uses
Grids
procedure TfrmPri.MudarComEnter(var Msg: TMsg; var Handled: Boolean);
begin
If not ((Screen.ActiveControl is TCustomMemo) or
(Screen.ActiveControl is TCustomGrid) or
(Screen.ActiveForm.ClassName = 'TMessageForm')) then
begin
If Msg.message = WM_KEYDOWN then
begin
Case Msg.wParam of
VK_RETURN,VK_DOWN : Screen.ActiveForm.Perform(WM_NextDlgCtl,0,0);
VK_UP : Screen.ActiveForm.Perform(WM_NextDlgCtl,1,0);
end;
end;
end;
end;
//No evento OnCreate o Form Principal digite a seguinte linha


Application.OnMessage := MudarComEnter;

Um comentário:

  1. :: Nas linhas
    VK_RETURN,VK_DOWN : Screen.ActiveForm.Perform(WM_NextDlgCtl,0,0);
    :: Uso
    VK_RETURN,VK_DOWN : Msg.wParam := VK_TAB;
    VK_UP :
    begin
    Msg.wParam := VK_CLEAR;
    Screen.ActiveForm.Perform(WM_NextDlgCtl,1,0);
    end;

    ResponderExcluir