unit Unit7;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.Controls.Presentation, FMX.Edit, FMX.StdCtrls;
type THelperObject = Class Helper for TFMXObject
Public
procedure Caption(Desc: String);
End;
type
TForm7 = class(TForm)
Edit1: TEdit;
StyleBook1: TStyleBook;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
procedure FormCreate(Sender: TObject);
procedure Edit1Enter(Sender: TObject);
procedure Edit1Exit(Sender: TObject);
private
public
end;
var
Form7: TForm7;
implementation
{$R *.fmx}
procedure THelperObject.Caption(Desc: String);
var
lbl :Tlabel;
begin
lbl := TLabel.create(Self);
lbl.Text := desc;
lbl.Name := 'Label'+ self.Name;
lbl.StyledSettings := [TstyledSetting.Family];
lbl.Position.X := 3;
lbl.Position.Y := 0;
lbl.TextSettings.Font.Size := 18;
lbl.TextSettings.FontColor := Talphacolors.Darkgrey;
lbl.Parent := self;
end;
procedure TForm7.Edit1Enter(Sender: TObject);
var
runlbl: Tlabel;
begin
if (Sender as TEdit).text = '' then
begin
runlbl := Tlabel((Sender as TEdit).FindComponent('Label' + (Sender as TEdit).Name ));
runlbl.AnimateFloat('Font.Size',9,0.1, TAnimationtype.InOut,tinterpolationType.Linear);
runlbl.AnimateFloat('Position.y',-16,0.1, TanimationType.InOut, TInterpolationType.Linear );
runlbl.FontColor := TAlphacolors.Blue;
end;
end;
procedure TForm7.Edit1Exit(Sender: TObject);
var
runlbl: Tlabel;
begin
if (Sender as TEdit).text = '' then
begin
runlbl := Tlabel((Sender as TEdit).FindComponent('Label' + (Sender as TEdit).Name ));
runlbl.AnimateFloat('Font.Size',14,0.1, TAnimationtype.InOut,tinterpolationType.Linear);
runlbl.AnimateFloat('Position.y',3,0.1, TanimationType.InOut, TInterpolationType.Linear );
runlbl.FontColor := TAlphacolors.Black;
end;
end;
procedure TForm7.FormCreate(Sender: TObject);
begin
Edit1.Caption('Nombre');
Edit2.Caption('Domicilio');
Edit3.Caption('Telefono');
Edit4.Caption('Email');
end;
end.