Fórum Mudar foco ao digitar no edit #395023
03/02/2011
0
Luiz Carlos
Curtir tópico
+ 1Posts
03/02/2011
Marco Salles
Gostei + 0
03/02/2011
Luiz Carlos
Gostei + 0
03/02/2011
Emerson Nascimento
SendMessage(Handle, WM_NEXTDLGCTL, 0, 0); // vai para o próximo componente (TabOrder)
SendMessage(Handle, WM_NEXTDLGCTL, 1, 0); // vai para o componente anterior (TabOrder)
assim você poderá alterar a ordem dos seus componentes sem preocupar-se com o comando colocado no evento.
Gostei + 0
03/02/2011
Efraim Santana
é só colocar o valor no maxlength do Edit.
dessa forma funciona em qualquer lugar.
procedure TForm1.FormCreate(Sender: TObject);begin Application.OnMessage := OnMessageNew;end; procedure TForm1.OnMessageNew(var Msg: TMsg; var Handled: Boolean);begin if ( Screen.ActiveControl is TEdit ) then begin if (Length((Screen.ActiveControl As TEdit).Text) = (Screen.ActiveControl As TEdit).MaxLength) and ((Screen.ActiveControl As TEdit).Tag = 1) then begin (Screen.ActiveControl As TEdit).Tag := 1; end else begin (Screen.ActiveControl As TEdit).Tag := 0; end; if ((Screen.ActiveControl As TEdit).MaxLength > 0) and (Length((Screen.ActiveControl As TEdit).Text) = (Screen.ActiveControl As TEdit).MaxLength) and ((Screen.ActiveControl As TEdit).Tag = 0) then begin (Screen.ActiveControl As TEdit).Tag := 1; Perform(WM_NEXTDLGCTL,0,0); end; end;end;
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)