Fixed: Hello WAS: Re: [lazarus] Editor crashing when adding text

Sylvain Lamothe lamothes at sympatico.ca
Mon Dec 6 21:39:28 EST 1999



----- Original Message -----
From: <vital at videotron.ca>
To: <lazarus at miraclec.com>
Sent: Monday, December 06, 1999 8:29 PM
Subject: Re: Fixed: Hello WAS: Re: [lazarus] Editor crashing when adding
text


> At 02:24 99-12-07 +0100, you wrote:
> >
> >Ah, thats an easy one.
> >
> >Since now (or for while), to show a control is has to have at least a
> >Parent. In the past the owner was erroneous used as a parent. (The owner
is
> >the VCL/LCL class owner, not the graphical owner). Thats why the button
> >doid show up in the past and didnt till now.
> >(You can try to create a button without parent in Delphi!)
> >
> >Marc
>
> Marc, you obsolutly need a parent in Delphi else you raise an exception.
>

Sorry Vital but i have to tell you that not setting a parent for a
TComponent wont
raise an exception. The effect of not setting a parent is that it will not
show up since
it doesn't no where to show up.

try that code:

procedure TForm1.Button1Click(Sender: TObject);
Var
  MyButton : TButton;
begin
  MyButton := TButton.Create(Self);//No exception raised here
end;

Now try this one:

procedure TForm1.Button1Click(Sender: TObject);
Var
  MyButton : TButton;
begin
  MyButton := TButton.Create(Self);
  MyButton.Parent := Self; // Magic, it show itself on the form
end;

Sylvain Lamothe :)
lamothes at sympatico.ca






More information about the Lazarus mailing list