Sign in Join

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

Mailing lists / lazarus / 2016-01

Something the examine Lazarus or applications?

10 messages · 6 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160111/a19694b7/attachment.html>

Reply by email

Michael Van Canneyt
to Anthony Walter
Anthony Walter wrote 6 lines
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.

Reply by email

Ondrej Pokorny
to Anthony Walter
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

Reply by email

Michael Van Canneyt
to Ondrej Pokorny
Ondrej Pokorny wrote 8 lines
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.

Reply by email

Paul Breneman
to Michael Van Canneyt
Michael Van Canneyt wrote 16 lines
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.

Reply by email

Bart
to Michael Van Canneyt: I also never heard of this, and I develop applications since way before Delphi 7. Michael.
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

Reply by email

Ondrej Pokorny
to Bart
Bart wrote 11 lines
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 FOwnerNil Then FOwner.RemoveComponent(Self);
   inherited destroy;
end;

Of course this works:

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

Ondrej

Reply by email

Anthony Walter
to Bart: That would lead to crashes all over the place: C:=TComponent.Create(nil); try ... finally…

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160111/3e5d3dc4/attachment-0001.html>

Reply by email

Dmitry Boyarintsev
to Anthony Walter
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160111/b31ba827/attachment.html>

Reply by email