Ver Mensaje Individual
  #3  
Antiguo 27-10-2005
onlytk onlytk is offline
Miembro
 
Registrado: oct 2005
Posts: 53
Reputación: 19
onlytk Va por buen camino
El siguiente codigo es del evento en un boton, que tambien atrapa el ENTER.

Código Delphi [-]
 procedure TfrmLogin.btnValidarClick(Sender: TObject);
 begin
   ShowMessage( 'ERROR' );
   edtUsuario.SetFocus;
 end;
A continuacion el evento que hace el trabajo de poner el foco al siugiente control:

Código Delphi [-]
 procedure TfrmLogin.FormKeyUp(Sender: TObject;
   var Key: Word; Shift: TShiftState);
 begin
   if (ActiveControl is TEdit) then
   begin
     if Key = VK_RETURN then
     SelectNext(ActiveControl, True, True);
   end;
   if Key = VK_ESCAPE then
     Close;
 end;
El formulario consta de 2 TEdit, y 2 TButton, al presionar enter sobre un BOTON, me muestra el mensaje de error, y deberia pasar el foco a un TEdit, pero al parecer el formulario atrapa este enter y hace que se pase al SIGUIENTE control

Bueno espero me ayuden, Salu2

Última edición por dec fecha: 28-10-2005 a las 05:37:54. Razón: ¡¡Encerrad el código fuente entre las etiquetas [DELPHI] ... [/DELPHI]!!
Responder Con Cita