Converter TAB em ENTER
Oi, gostaria de saber como posso trocar o TAB pelo ENTER...tipo, preenchi o primeiro edit, na hora q. for preencher o segundo, quero pressionar ENTER e naum TAB...como faço isso??????
Diana
Curtidas 0
Melhor post
Jonhy Riper
21/03/2003
------
EM TODA A APLICAÇÃO 8)
-------
A vantagem em relação as outras é que você coloca apenas no formulario principal, e funciona em toda a aplicação sem a necessidade de inserir um codigo por formulario
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;
EM TODA A APLICAÇÃO 8)
-------
A vantagem em relação as outras é que você coloca apenas no formulario principal, e funciona em toda a aplicação sem a necessidade de inserir um codigo por formulario
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;
GOSTEI 2
Mais Respostas
Carlos Alberto
21/03/2003
Oi Diana,
Existem componentes prontos que fazem isso. Basta procurar. Se você quiser eu tenho um e posso enviar, basta me passar um e-mail.
carlos@dp2000.com.br
Até mais.
Existem componentes prontos que fazem isso. Basta procurar. Se você quiser eu tenho um e posso enviar, basta me passar um e-mail.
carlos@dp2000.com.br
Até mais.
GOSTEI 0
Rafaela
21/03/2003
DIANA PRIMEIRO VÁ NA PROPRIEDADE KEYPREVIEW DO FORM E COLOQUE TRUE DEPOIS VÁ NO EVENTO ONKEYPRESS DO FORM E COLOQUE:
If Key = #13 then
Begin
Key:=0;
Perform(CM_DIALOGKEY,VK_TAB,0);
end;
PRONTO, É SÓ ISSO....
ESPERO TER AJUDADO
RAFAELA
If Key = #13 then
Begin
Key:=0;
Perform(CM_DIALOGKEY,VK_TAB,0);
end;
PRONTO, É SÓ ISSO....
ESPERO TER AJUDADO
RAFAELA
GOSTEI 1
Anonymous
21/03/2003
no onKeyPress do form digite
if key = #13 then begin
key := 0;
perform(wm_nextdlgctl, 0, 0);
END;
IF key = 27 then begin
close;
end;
naum esqueça de deichar o keyPreview para true;;;
if key = #13 then begin
key := 0;
perform(wm_nextdlgctl, 0, 0);
END;
IF key = 27 then begin
close;
end;
naum esqueça de deichar o keyPreview para true;;;
GOSTEI 0
E_gama
21/03/2003
Configure a propriedade [b:11071566f9]KeyPreview[/b:11071566f9] do seu Form para [b:11071566f9]TRUE[/b:11071566f9], depois no evento [b:11071566f9]OnKeyPress[/b:11071566f9] do form, escreva:
if Key = #13 then begin Key := 0; SelectNext(ActiveControl, True, True); end;
GOSTEI 1
Diana Santos
21/03/2003
Obrigado pessoal pelas repostas, ajudaram muito!
GOSTEI 0