Qdo o usr terminar de digitar o código (4 caracteres)....
11/03/2003
0
.... tenho que passar para o próximo edit
Como posso fazer?
Como posso fazer?
Debora
Curtir tópico
+ 0
Responder
Posts
11/03/2003
Poeta Noturno
Oi Debora, faça o seguinte:
if lenght(edit1.text) = 4 then
edit2.setfocus;
Um abraço
Poeta Noturno
if lenght(edit1.text) = 4 then
edit2.setfocus;
Um abraço
Poeta Noturno
Responder
11/03/2003
Desander
exemplo :
edite o maxlength do edit1 para 4.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
procedure Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
x: integer;
implementation
{$R *.DFM}
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Edit1.Text = ´´ then x:=0;
x:= x + 1;
if Edit1.MaxLength = x then
Edit2.setFocus;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
x:= 0;
end;
end.
edite o maxlength do edit1 para 4.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
procedure Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
x: integer;
implementation
{$R *.DFM}
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Edit1.Text = ´´ then x:=0;
x:= x + 1;
if Edit1.MaxLength = x then
Edit2.setFocus;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
x:= 0;
end;
end.
Responder
Clique aqui para fazer login e interagir na Comunidade :)