tab por enter

Delphi

27/07/2005

gente é o seguinte, preciso mudar o tab por enter, mas não quero fazer isso em todo evento, gostaria de mudar em uma parte global do projeto e ser assumido por todo ele!!!


Tio_da_pipoca

Tio_da_pipoca

Curtidas 0

Respostas

Paullsoftware

Paullsoftware

27/07/2005

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;


no OnCreate do Form Principal coloque:::
Application.OnMessage := MudarComEnter;


no form ou no componente que vc não quer que o Enter funcione como tab mude a propriedade KeyPreviw = False, quando quiser novamente mude KeyPreviw = True.
eu faço assim :wink:


GOSTEI 0
Marco Salles

Marco Salles

27/07/2005

existe varias maneiras

eu costumo fazer assim :

No evento onKeyDow do componente que eu quero trocar Enter por Tab eu faço assim:

procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key=Vk_Return then
    Perform(Wm_NextDlgCtl, 0, 0);
end;



GOSTEI 0
Henrique Rodrigues

Henrique Rodrigues

27/07/2005

tentei usar a dica do PaullSoftware mas nem deu certo.
onde coloco a primeira instrução?

erro que tive: [Error] Unit_Index.pas(111): Incompatible types: ´method pointer and regular procedure´


GOSTEI 0
POSTAR