Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 1999-12

Fixed: Hello WAS: Re: Editor crashing when adding text

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 Weustink
to Unknown author: Marc, you obsolutly need a parent in Delphi else you raise an exception. Vital Tremblay
you wrote 14 lines
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.

:-) :-) thats why we need in Lazarus a Parent as well.

Marc

Reply by email

Samuel Liddicott
to Unknown author: Marc, you obsolutly need a parent in Delphi else you raise an exception. Vital Tremblay
Show quoted text 22 lines
-----Original Message----- From: Sent: Tuesday, December 07, 1999 01:30 AM To: 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.

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

Reply by email

Unknown author
you wrote 10 lines
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.

Vital Tremblay

Reply by email

Unknown author
you wrote 10 lines
> At 02:24 99-12-07 +0100, you wrote: > > 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.

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

Reply by email

Marc Weustink
to Samuel Liddicott: 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

Reply by email

Sylvain Lamothe
to Unknown author: 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

Show quoted text 6 lines
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

Show quoted text 8 lines
>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 :)

Reply by email

Unknown author
you wrote
At 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

Reply by email