Marc, you obsolutly need a parent in Delphi else you raise an exception. Vital Tremblay
you wrote 14 lines
:-) :-) thats why we need in Lazarus a Parent as well.
Marc

Mailing lists / lazarus / 1999-12
7 messages · 4 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Marc, you obsolutly need a parent in Delphi else you raise an exception. Vital Tremblay
:-) :-) thats why we need in Lazarus a Parent as well.
Marc
Marc, you obsolutly need a parent in Delphi else you raise an exception. Vital Tremblay
You don't have to raise an exception. I sometimes have controls about without parents. Of course they are not visible, I set the parent when and where I want them to appear.
I also often change the parent during runtime to make controls appear somewhere else (hence need for destroywnd and createwnd)
Sam
Marc, you obsolutly need a parent in Delphi else you raise an exception.
Vital Tremblay
Ok You're right, I did try to raise an exception but it didn't. I used to recall a time when that did but may be was just a special case or in a previous version of Delphi where it behave differently. Thank Sylvain!
Vital Tremblay
You don't have to raise an exception. I sometimes have controls about without parents. …
+ From: Samuel Liddicott
+
+ > -----Original Message-----
+ > From:
+ >
+ > At 02:24 99-12-07 +0100, I 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.
+
+ You don't have to raise an exception. I sometimes have controls about
+ without parents. Of course they are not visible, I set the
+ parent when and
+ where I want them to appear.
+
+ I also often change the parent during runtime to make controls appear
+ somewhere else (hence need for destroywnd and createwnd)
You only get an exeption if you want the handle of your control when it has no parent. And as far as I can recall in Lazarus it is the same. As long as you don't need the handle (IE, the physical component) it is OK to have no parent.
Marc
Marc, you obsolutly need a parent in Delphi else you raise an exception. Vital Tremblay
----- Original Message -----
From:
To:
Sent: Monday, December 06, 1999 8:29 PM
Subject: Re: Fixed: Hello WAS: Re: [lazarus] Editor crashing when adding text
is
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 :)
you wroteAt 20:29 06-12-99 -0500, you wrote: :-) :-) thats why we need in Lazarus a Parent as well. Marc
Also, must of the time the Owner of a TComponent is a Tform and the Owner of a TForm is The TApplication and the Owner of the Application is Nil. That's the way Delphi does when loading component from a .dfm but it you create a TForm at the run time you could make his Owner Nil in this case you must manualy freed this form while when the Owner of a TForm is Application Delphi automaticaly Free it when the application is closing.
Vital Tremblay