Using Tedit Inside of a FireMonkey component

  

I have created a component in Fire-monkey and also created a TEdit inside it.
My component has a String Property named Value that by pouting any string to it , My Component will show that in Tedit.
at design Time every thing is OK. but at Run time no thing shows in Tedit
My Code is

type
TMyComponent = class(TPanel)
private
{ Private declarations }
Edit:TEdit;
FValue:String;
Procedure SetValue(Const Value:String);
protected
{ Protected declarations }
Constructor Create(Aoner:TComponent); Override;
Destructor Destroy; Override;
public
{ Public declarations }
published
{ Published declarations }
Property Value:String Read FValue Write SetValue;
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents(‘Samples’, [TMyComponent]);
end;

Constructor TMyComponent.Create(Aoner:TComponent);
begin
Inherited;
Width:=100;
Height:=100;
Edit:=TEdit.Create(Self);
Edit.Parent:=Self;
Edit.Width:=30;
Edit.Text:=”;
Edit.Align:=TAlignLayout.Scale;
end;

Procedure TMyComponent.SetValue(const Value: string);
begin
FValue:=Value;
Edit.Text:=FValue;
end;

Destructor TMyComponent.Destroy;
begin
Edit.Destroy;
Inherited Destroy;
end;
end.

What Should I do?

Comments are closed.