Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #8  
Antiguo 22-03-2010
Avatar de Softweb
Softweb Softweb is offline
Miembro
 
Registrado: ago 2008
Posts: 46
Poder: 0
Softweb Va por buen camino
Thumbs up

Hola a todos.

Hay una forma mas eficiente de controlar el enter en una aplicacion, yo la que utilizo desde hace años es esta.

Crear esta función (AppMessage) en el formulario principal.
Código Delphi [-]
procedure TMain.AppMessage(var Msg: TMsg; var Handled: Boolean); 
var   
   actual: TWinControl; 
begin   
   if Msg.message = WM_KEYDOWN then      
     begin      
     if Screen.ActiveControl.Tag = 77 then Exit;      
     case Msg.wParam of        
       VK_ADD: ;//        
       VK_F12: ;//        
       VK_RETURN: 
          begin           
          actual := Screen.ActiveControl;           
          if actual is TEdit then Msg.wParam := VK_TAB;           
          if actual is TJvValidateEdit then Msg.wParam := VK_TAB;           
          if actual is TDBEdit then Msg.wParam := VK_TAB;           
          if actual is TjvDateEdit then             
            if not TjvDateEdit(actual).PopupVisible then Msg.wParam := VK_TAB;           
          if actual is TjvDBDateEdit then             
            if not TjvDBDateEdit(actual).PopupVisible then Msg.wParam := VK_TAB;           
          if actual is TDateTimePicker then Msg.wParam := VK_TAB;           
          if actual is TDBLookupComboBox then             
            if not TDBLookupComboBox(actual).ListVisible then Msg.wParam := VK_TAB;           
          if actual is TjvDBLookupCombo then             
            if not TjvDBLookupCombo(actual).ListVisible then Msg.wParam := VK_TAB;           
          if actual is TStringGrid then Msg.wParam := VK_TAB;           
        END;        
      end;      
     end; 
end;

y en el create del formulario poner esto
Código Delphi [-]
Application.OnMessage := AppMessage;

Con esto tendrás toda la aplicación controlados los enter, pero solo de los tipos de controles que ayas declarado y si algún control no quieres que trasforme los enter por tad y esta declarado su tipo le pones el tag a 77 y listo.

Funciona de maravilla y ademas te da un fuerte control de cualquier tecla que se pulse.

Saludos.

Última edición por Softweb fecha: 22-03-2010 a las 16:57:21.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Desaparecieron todos los Tabs de Herramientas robertosc Varios 0 12-06-2008 14:59:00
multilineal tabs Crisperre Varios 5 12-05-2007 22:40:47
Tabs como FireFox Troffed Varios 5 11-04-2007 14:25:38
Tabs e Imagelist piccolo2101 Varios 11 16-11-2005 18:29:59
¿Como crear Tabs. ? JXJ Varios 4 21-09-2005 05:51:49


La franja horaria es GMT +2. Ahora son las 14:15:57.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi