Fazer ENTER funcionar como TAB

Delphi

26/02/2003

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:


Anonymous

Anonymous

Curtidas 0

Respostas

Anonymous

Anonymous

26/02/2003

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;


GOSTEI 0
Trampo

Trampo

26/02/2003

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:


GOSTEI 0
POSTAR