Hi! I'm trying to make a new control (class) derivated from TCustomPanel class. A easy and simplified code version of this class is:
unit Test;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, LMessages;
type
TTest = class(TCustomPanel)
private
{ Private declarations }
ControlOne : TEdit;
ControlTwo : TLabel;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create (AOwner : TComponent) ; override;
destructor Destroy; override;
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Standard',[TTest]);
end;
constructor TTest.Create (AOwner : TComponent) ;
begin
inherited Create (AOwner);
Height := 136;
Width := 176;
ClientHeight := 132;
ClientWidth := 172;
Constraints.MaxHeight:=136;
Constraints.MaxWidth :=176;
Constraints.MinHeight:=136;
Constraints.MinWidth :=176;
CAPTION :='';
ControlOne:= TEdit.Create(Self);
ControlOne.Parent:= Self;
ControlOne.SetSubComponent(true);
ControlOne.ControlStyle := ControlOne.ControlStyle - [csNoDesignSelectable];
ControlOne.Name := 'Input1';
ControlOne.Text := '1';
ControlOne.Left := 36;
ControlOne.Height := 23;
ControlOne.Top := 20;
ControlOne.Width := 130;
ControlTwo := TLabel.Create(Self);
ControlTwo.Parent:= Self;
ControlTwo.SetSubComponent(true);
ControlTwo.ControlStyle := ControlTwo.ControlStyle - [csNoDesignSelectable];
ControlTwo.Name := 'Label1';
ControlTwo.Caption := 'Label1';
end;
destructor TTest.Destroy;
begin
ControlTwo.Free;
ControlOne.Free;
inherited Destroy;
end;
end.
That code compile OK and I can create a new package with this new class: TTest. I can create a new form with this new control, but, I get a problem.
TCustomPanel has a default "Caption text" , I don't want that text. Inside the constructor, I added the following code to delete that text:
CAPTION :='';
but the text is always on . How can I delete that text?
Thanks in advanced