TEMMO stream with empty lines

My descendant TMemo has a constructor

constructor TMyMemo.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  Lines.Clear;
end;

      

When I put TMyMemo on the form, I get the error "Control" has no parent window. ". Why?

+3
delphi vcl


source to share


2 answers


The newly created note has no content. But content is added as soon as the component gets a name, which the designer automatically performs. To prevent this, remove csSetCaption

from ControlStyle

:



constructor TMyMemo.Create(AOwner: TComponent); 
begin 
  inherited Create(AOwner); 
  ControlStyle := ControlStyle - [csSetCaption];
end; 

      

+17


source to share


Move Lines.Clear to override CreateWnd method. Stream window control (multi-line edit) does not exist during creation run



0


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics