Fórum Mudança de foco com enter #182800
18/09/2003
0
Já utilizei
if key=VK_RETURN then Perform(Wm_nextDlgCtl,0,0);
mas não deu certo, o que posso fazer ?
Hemerson
Curtir tópico
+ 0Posts
18/09/2003
Patrick
na sessão de declaração das procedures:
procedure ProcessaMsg(Var Msg: TMsg; var Handled: Boolean);
e depois da diretiva de compilação: {$R *.dfm}
uso a procedure....:
procedure TfPrincipal.ProcessaMsg(var Msg: TMsg; var Handled: Boolean);
Begin
If (Msg.message = WM_KEYDOWN) then
If not (Screen.ActiveControl is TCustomMemo) and not (Screen.ActiveControl is TButtonControl) then
Begin
If not (Screen.ActiveControl is TCustomControl) then
begin
If Msg.wParam=VK_Down then
Msg.wParam:=VK_Tab;
If Msg.wParam=VK_UP then
begin
Msg.wParam:=VK_CLEAR;
Screen.ActiveForm.Perform(WM_NextDlgCtl,1,0);
end;
If Msg.wParam=VK_Escape then
Close
end;
If Msg.wParam=VK_Return then
Msg.wParam:=Vk_Tab;
end;
end;
ele usa o enter, o tab, as setas.....
testa e ve se funciona!!!!
Gostei + 0
18/09/2003
E_gama
- Configuro a propriedade [b:7f618474b1]KeyPreview[/b:7f618474b1] do TForm para [b:7f618474b1]True[/b:7f618474b1]
- Depois, no OnKeyPress do TForm faço:
if Key = #13 then begin Key := 0; SelectNext(ActiveControl, True, True); end;
Gostei + 0
18/09/2003
Tio Frank
begin
IF KEY = #13 THEN
EDIT.SETFOCUS;
IF KEY = 27 THEN
EDIT.SETFOCUS;
IF (KEY IN [´0´..´9´]) THEN
KEY := 0;
end;
SE FOR UM CAMPO PARA ACEITAR SÓ NÚMEROS :
begin
IF KEY = 13 THEN
EDIT.SETFOCUS;
IF KEY = 27 THEN
EDIT.SETFOCUS;
IF NOT (KEY IN [´0´..´9´, 8]) THEN
KEY := 0;
end;
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)