Re: [Lazarus] Something the examine Lazarus or applications?

2016-01-11 Thread Dmitry Boyarintsev
On Mon, Jan 11, 2016 at 12:58 PM, Anthony Walter  wrote:

> Others: If I can dig up my D7 SE installer I'll attempt to verify. I
> distinctly remember being surprised at this behavior in D5 1999, but I
> could be mis-remembering.
>
I've D7 here.
I tried Ondrej's sample here and it throws the assertion error.

It's also hard to understand how would
  Owner = nil
be forced to
  Owner = Application
for console programs, where "Forms" unit is not used.

thanks,
Dmitry
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Something the examine Lazarus or applications?

2016-01-11 Thread Anthony Walter
Bart: Not really. When you free a component it's removed from the owner's
list.

Others: If I can dig up my D7 SE installer I'll attempt to verify. I
distinctly remember being surprised at this behavior in D5 1999, but I
could be mis-remembering.
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Something the examine Lazarus or applications?

2016-01-11 Thread Ondrej Pokorny

On 11.01.2016 18:26, Bart wrote:

That would lead to crashes all over the place:

C:=TComponent.Create(nil);
try
...
finally
   C.Free;
end;

Upon app termination the Application object would the again try to
free C (note: it is not nil) -> Access Violation.


No, you are also wrong :) The owner is detached in the destructor. See:

Destructor TComponent.Destroy;
[...]
  If FOwner<>Nil Then FOwner.RemoveComponent(Self);
  inherited destroy;
end;

Of course this works:

C:=TComponent.Create(Application);
try
...
finally
  C.Free;
end;

Ondrej

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Something the examine Lazarus or applications?

2016-01-11 Thread Bart
 On 11.01.2016 17:44, Anthony Walter wrote:
> I Delphi at least if you create a component with AOwner set to nil it
> actually (tested under Delphi 7 at least) would set the Owner to
> Application.

That would lead to crashes all over the place:

C:=TComponent.Create(nil);
try
...
finally
  C.Free;
end;

Upon app termination the Application object would the again try to
free C (note: it is not nil) -> Access Violation.

Bart

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Something the examine Lazarus or applications?

2016-01-11 Thread Paul Breneman

On 01/11/2016 11:07 AM, Michael Van Canneyt wrote:



On Mon, 11 Jan 2016, Ondrej Pokorny wrote:


On 11.01.2016 17:44, Anthony Walter wrote:

I Delphi at least if you create a component with AOwner set to nil it
actually (tested under Delphi 7 at least) would set the Owner to
Application.


You are wrong:

 Assert(TComponent.Create(nil).Owner = Application);



I also never heard of this, and I develop applications since way before
Delphi 7.


CreateForm did this, but for forms not components.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Something the examine Lazarus or applications?

2016-01-11 Thread Michael Van Canneyt



On Mon, 11 Jan 2016, Ondrej Pokorny wrote:


On 11.01.2016 17:44, Anthony Walter wrote:
I Delphi at least if you create a component with AOwner set to nil it 
actually (tested under Delphi 7 at least) would set the Owner to 
Application.


You are wrong:

 Assert(TComponent.Create(nil).Owner = Application);



I also never heard of this, and I develop applications since way before Delphi 
7.

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Something the examine Lazarus or applications?

2016-01-11 Thread Ondrej Pokorny

On 11.01.2016 17:44, Anthony Walter wrote:
I Delphi at least if you create a component with AOwner set to nil it 
actually (tested under Delphi 7 at least) would set the Owner to 
Application.


You are wrong:

  Assert(TComponent.Create(nil).Owner = Application);

Ondrej

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Something the examine Lazarus or applications?

2016-01-11 Thread Anthony Walter
I Delphi at least if you create a component with AOwner set to nil it
actually (tested under Delphi 7 at least) would set the Owner to
Application.
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Something the examine Lazarus or applications?

2016-01-11 Thread Michael Van Canneyt



On Mon, 11 Jan 2016, Anthony Walter wrote:


Relevant link:

http://www.codebot.org/delphi/?doc=9579


My question is: Does anything like this already exist for Lazarus?


To my knowledge no such thing exists yet for Lazarus ?

I have something similar for my own applications, and it is indeed very
handy, so I am definitely interested in seeing this in Lazarus.

I am wondering, how can it find all live components ?
As soon as you do a
  TSomeComponent.Create(Nil);
then it cannot be found.

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Something the examine Lazarus or applications?

2016-01-10 Thread Anthony Walter
Relevant link:

http://www.codebot.org/delphi/?doc=9579

I've been submitting few patches the past few days and am considering
submitting a few more complex fixes, mostly having to do with the new
docked form editor and the new menu editor.

As I get more involved I am trying to figure out which IDE elements
(components and controls) I am looking at (or perhaps which ones are
hidden) and finding of their class names and the units to which they belong.

When I was working with Delphi extensions I wrote the tool linked at the
top of this message. The tool can either be inserted into the IDE or into
your own applications:

Basically what it does is allow you to see the entire tree of live
components in the IDE (or your application). It shows you the class
hierarchy of whatever you select along with the properties (which you could
edit), the embedded resources (lfm as text), package information, and even
an image capture of the live object if it was a control.

My question is: Does anything like this already exist for Lazarus?

I don't need all the feature I described, but it would be nice to be able
to examine the IDE to find the names of the components I am trying to fix.
For example, the main menu bar being attached to the docked form designer.

I could create a simplified version for Lazarus of the tool I linked at the
top of this message, but if something similar already exists for Lazarus
I'd prefer to use it.

Thanks.
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus