Fazer ENTER funcionar como TAB
26/02/2003
0
Fazer o ENTER Funcionar eu já sei, que o código é o seguinte:
if (Key = VK_RETURN) then
Perform(WM_NEXTDLGCTL,0,0);
Mas o X da questão é!!! Quando eu apertar a tecla de seta para cima,
ou seja VK_UP, eu queria que retornasse um campo, no meu caso o edit anterior que eu tinha dado um ENTER. Quem quiser me ajudar mande-me um e-mail :
giancarlocorrea@bol.com.br
Flw!!! :twisted:
if (Key = VK_RETURN) then
Perform(WM_NEXTDLGCTL,0,0);
Mas o X da questão é!!! Quando eu apertar a tecla de seta para cima,
ou seja VK_UP, eu queria que retornasse um campo, no meu caso o edit anterior que eu tinha dado um ENTER. Quem quiser me ajudar mande-me um e-mail :
giancarlocorrea@bol.com.br
Flw!!! :twisted:
Anonymous
Curtir tópico
+ 0
Responder
Posts
26/02/2003
Anonymous
Seta para cima
evento keydown
procedure Tform1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = 38 then Perform(Wm_NextDlgCtl,-1,0);
end;
evento keydown
procedure Tform1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = 38 then Perform(Wm_NextDlgCtl,-1,0);
end;
Responder
27/02/2003
Trampo
Assim e melhor:
Em Form.Create coloque uma chamada para uma rotina que vai avaliar
a tecla precionada
procedure Form1.FormCreate(Sender: TObject);
begin
Application.OnMessage := ProcessaMsg;
.....
end;
procedure Form1.ProcessaMsg(var Msg: TMsg; var Handled: Boolean);
begin // ATENCAO: necessita Messages no use
if not (ActiveControl is TRichEdit) then // não é richedit
if not (ActiveControl is TDBRichEdit) then // nem dbRichedit
if Not (ActiveControl is TDBMemo) then // nem tMemo entao
If Msg.Message = WM_KEYDOWN then // transforma return em TAB
if Msg.wParam = VK_Return then Keybd_event(VK_TAB,0,0,0);
end;
OK? :shock:
Em Form.Create coloque uma chamada para uma rotina que vai avaliar
a tecla precionada
procedure Form1.FormCreate(Sender: TObject);
begin
Application.OnMessage := ProcessaMsg;
.....
end;
procedure Form1.ProcessaMsg(var Msg: TMsg; var Handled: Boolean);
begin // ATENCAO: necessita Messages no use
if not (ActiveControl is TRichEdit) then // não é richedit
if not (ActiveControl is TDBRichEdit) then // nem dbRichedit
if Not (ActiveControl is TDBMemo) then // nem tMemo entao
If Msg.Message = WM_KEYDOWN then // transforma return em TAB
if Msg.wParam = VK_Return then Keybd_event(VK_TAB,0,0,0);
end;
OK? :shock:
Responder
Clique aqui para fazer login e interagir na Comunidade :)