Problemas com Perform
Pessoal é o seguinte eu chamo um formulário dentro de um panel, quando eu aperto a tecla tab ele funciona belezinha, só que no Key Press do edit eu coloquei o seguinte codigo:
if(Key = #13)then
Perform(WM_NEXTDLGCTL,0,0);
e quando eu aperto a tecla enter ele entar na funcao só que não acontece nada, eu ja coloquei como abaixo mais não acontece nada também:
meuform.Perform(WM_NEXTDLGCTL,0,0);
obrigado
if(Key = #13)then
Perform(WM_NEXTDLGCTL,0,0);
e quando eu aperto a tecla enter ele entar na funcao só que não acontece nada, eu ja coloquei como abaixo mais não acontece nada também:
meuform.Perform(WM_NEXTDLGCTL,0,0);
obrigado
Leonardobhbr
Curtidas 0
Melhor post
Thomaz_prg
11/09/2005
Você poderia fazer assim:
Uses Grids
...
procedure TfrmPri.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: 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;
Desse jeito, em toda a aplicação o Enter substituiria o tab, e a seta para cima, substitui o presionamento de Shift+Tab.
(Tirada de dicas Deephi)
Uses Grids
...
procedure TfrmPri.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: 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;
Desse jeito, em toda a aplicação o Enter substituiria o tab, e a seta para cima, substitui o presionamento de Shift+Tab.
(Tirada de dicas Deephi)
GOSTEI 1
Mais Respostas
G1b4
10/09/2005
Basta setar a propriedade keypreview=true do form...
GOSTEI 0
Steve_narancic
10/09/2005
Ao invés de:
tente:
Perform(WM_NEXTDLGCTL,0,0);
tente:
keybd_event(VK_TAB, 0, KEYEVENTF_EXTENDEDKEY or 0, 0);
GOSTEI 0
Wilson Rabelo
10/09/2005
Você poderia fazer assim:
Uses Grids
...
procedure TfrmPri.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: 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;
Desse jeito, em toda a aplicação o Enter substituiria o tab, e a seta para cima, substitui o presionamento de Shift+Tab.
(Tirada de dicas Deephi)
Obrigado.
Uses Grids
...
procedure TfrmPri.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: 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;
Desse jeito, em toda a aplicação o Enter substituiria o tab, e a seta para cima, substitui o presionamento de Shift+Tab.
(Tirada de dicas Deephi)
GOSTEI 0