Fórum Texto no edit como nos sites #592703
24/04/2018
0
Vinícius Trentin
Curtir tópico
+ 0Posts
24/04/2018
Douglas Sousa
Gostei + 0
24/04/2018
Vinícius Trentin
Gostei + 0
24/04/2018
Natanael Ferreira
Só que o texto do TextHint irá sumir ao focar o Edit e não ao digitar como você precisa.
Gostei + 0
24/04/2018
Vinícius Trentin
Gostei + 0
25/04/2018
Fabricio Kawata
Um abraço!
Gostei + 0
26/04/2018
Raimundo Pereira
procedure TForm1.Edit1Change(Sender: TObject);
begin
if Edit1.Text<>'Buscar' then
begin
Edit1.Text:=StringReplace(Edit1.Text, 'Buscar', '', [rfReplaceAll, rfIgnoreCase]);
end;
Com a rotina acima, o texto buscar permanece até mesmo quando é focado no edit, o texto é removido quando for diferente da palavra Buscar.
Lembrando que sua propriedade text inicial deverá Edit1.Text:='Buscar'
Gostei + 0
26/04/2018
Raimundo Pereira
ar
Form1: TForm1;
var tmp:tlabel;
implementation
{$R *.dfm}
//Aqui ele trata assim que é digitado algo dentro do edit.
procedure TForm1.Edit1Change(Sender: TObject);
begin
if Edit1.Text<>'' then
begin
tmp.Visible:=false;
end
else
begin
tmp.Visible:=True;
end;
end;
//Cria a Label
procedure TForm1.FormCreate(Sender: TObject);
begin
Edit1.Text:='';
tmp:=TLabel.Create(nil);
tmp.Parent:=Edit1;
tmp.Caption:='Buscar';
tmp.Visible:=true;
end;
end.
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)