I'm a newbie in Firemonkey/custom controls so sorry if this is a banal question or a duplicate one but I'm stuck and can't figure it out.
Here's the code of my custom control
unit swScheduler;
interface
uses
System.SysUtils, System.Classes, FMX.Types, FMX.Controls, FMX.StdCtrls,
FMX.Calendar, FMX.Objects;
type
TswScheduler = class(TControl)
private
{ Private declarations }
paLaterale: TPanel;
clCalendario: TCalendar;
paLibero: TPanel;
paScheduler: TPanel;
rcSCTop: TRectangle;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create( AOwner: TComponent ); override;
destructor Destroy; override;
published
{ Published declarations }
property Align default TAlignLayout.None;
property Enabled;
property Left;
property Top;
property Width;
property Height;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('CustomControls', [TswScheduler]);
end;
{ TswScheduler }
constructor TswScheduler.Create( AOwner: TComponent );
begin
inherited;
Self.Width := 650;
Self.Height := 400;
paLaterale := TPanel.Create( Self );
paLaterale.Parent := Self;
paLaterale.Align := TAlignLayout.Left;
paLaterale.Width := 202;
clCalendario := TCalendar.Create( Self );
clCalendario.Parent := paLaterale;
clCalendario.Align := TAlignLayout.Top;
paLibero := TPanel.Create( Self );
paLibero.Parent := paLaterale;
paLibero.Align := TAlignLayout.Client;
paScheduler := TPanel.Create( Self );
paScheduler.Parent := Self;
paScheduler.Align := TAlignLayout.Client;
rcSCTop := TRectangle.Create( Self );
rcSCTop.Parent := paScheduler;
rcSCTop.Align := TAlignLayout.Top;
rcSCTop.Height := 100;
end;
destructor TswScheduler.Destroy;
begin
inherited;
end;
initialization
RegisterClass( TswScheduler );
end.
It compiles without errors but my problem is when I want to use it.
I drop it on a form at design time without problems/errors
but when I run the application it does this
and if I close and re-open the pas file in the IDE it does the same thing
and when running the app...
Like if it does the constructor again and again.
I searched on Google but could'f find something like this about firemonkey.
I tried to change something but couldn't make it work.
Any tips is appreciated. Thanks in advance.
I'm using Delphi XE8 and Firemonkey.
You need to set the stored property of your sub components to false.