Fórum Trocar o TAB por Enter em Toda a Aplicação..Como? #292811
23/08/2005
0
Estou dando manutenção para um cliente, e ele pediu para mim trocar o tab por enter para mudar de campo de toda a aplicação.. só que tem um problema o sistema não utilizada herança de forms.. tem alguma forma de mudar em toda a aplicação, sem ter que entrar em kda form?
Daniel Martins
Curtir tópico
+ 0Posts
23/08/2005
Wilson Brito
Uses
Grids
procedure TFormPrincipal.MudarComEnter(var Msg: TMsg; var Handled: Boolean);
begin
If not ((Screen.ActiveControl is TCustomMemo) or
(Screen.ActiveControl is TCustomGrid) or
(Screen.ActiveForm.ClassName = ´TMessageForm´)) then
begin
If Msg.message = WM_KEYDOWN then
begin
Case Msg.wParam of
VK_RETURN,VK_DOWN : Screen.ActiveForm.Perform(WM_NextDlgCtl,0,0);
VK_UP : Screen.ActiveForm.Perform(WM_NextDlgCtl,1,0);
end;
end;
end;
end;
no evento OnCreate o Form Principal digite a seguinte linha
Application.OnMessage := MudarComEnter;
Gostei + 0
24/08/2005
Henrique Rodrigues
[Error] Unit_Index.pas(113): Incompatible types: ´method pointer and regular procedure´
o que fiz de errado?
Gostei + 0
24/08/2005
Wilson Brito
unit UntPrincipal;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Grids;
type
TFormPrincipal = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
procedure MudarComEnter(var Msg: TMsg; var Handled: Boolean);
{ Public declarations }
end;
var
FormPrincipal: TFormPrincipal;
implementation
{$R *.dfm}
procedure TFormPrincipal.MudarComEnter(var Msg: TMsg; var Handled: Boolean);
begin
If not ((Screen.ActiveControl is TCustomMemo) or
(Screen.ActiveControl is TCustomGrid) or
(Screen.ActiveForm.ClassName = ´TMessageForm´)) then
begin
If Msg.message = WM_KEYDOWN then
begin
Case Msg.wParam of
VK_RETURN,VK_DOWN : Screen.ActiveForm.Perform(WM_NextDlgCtl,0,0);
VK_UP : Screen.ActiveForm.Perform(WM_NextDlgCtl,1,0);
end;
end;
end;
end;
procedure TFormPrincipal.FormCreate(Sender: TObject);
begin
Application.OnMessage := MudarComEnter;
end;
end.
Gostei + 0
24/08/2005
Daniel Martins
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)