Jump to content
PeterPanettone

Tool to inspect properties at run-time?

Recommended Posts

Does anybody know a tool for Delphi 10.4.2 that can inspect the properties of all classes and objects in a Delphi program at run-time?

 

Once there has been such a tool by Marco Cantu: OBJECT DEBUGGER But it seems its development stopped at Delphi 5?

Share this post


Link to post

Thanks, this component looks very interesting. But I was looking for a tool similar to that created by Marco Cantu.

Share this post


Link to post

Yes, it works in Sydney:

 

OD.thumb.png.e46b9dc674619ec64cc63afb97f6cd77.png

 

I could change the Caption of the TPanel, but not its color. However, just inspecting all the properties is very useful!

Share this post


Link to post

When closing and then reopening my test project the IDE displayed this error message:

 

image.png.432d4fd65c18e5cc8e53eff9bbe3e366.png

 

I had to click on 'Ignore'. If not, the Designer was not accessible.

 

Then I tried to show the Object Debugger at run-time:

 

procedure TForm1.btn1Click(Sender: TObject);
begin
  pnl1.Color := clYellow;
  OD.Show;
end;

But that produces an AV:

 

image.thumb.png.f52cbd3324292a2006ecb48d54763e39.png

 

So, in its current state, the ObjectDebugger is unusable: It would be nice if Marco could fix these bugs. Does anybody have Marco's email address?

 

 

Share this post


Link to post
3 hours ago, PeterPanettone said:

Does anybody have Marco's email address?

 

 

marco.cantu[at]embarcadero.com. He has contributed to this forum before so may respond to you here. You can find other ways to contact him via his website:

https://www.marcocantu.com/

  • Thanks 1

Share this post


Link to post
Posted (edited)

From the screenshot, I can see that the Objectspector is part of Scripter Studio. But can that ObjectInspector also be used as a component in your application?

Edited by PeterPanettone

Share this post


Link to post
4 hours ago, Wagner Landgraf said:

TMS Scripter has an object inspector control (it's an evolution from the Greatis one)

Are you sure about that?

I believe TMS purchased their run-time design controls (OI, form designer, etc) from some Chinese gentleman. AFAIK the same person that was the author of the K-Wizard controls.

I'm using his original controls in my Resource Editor:

image.thumb.png.f2083c95952923f10e3acf54e63ec100.png

Share this post


Link to post
8 hours ago, PeterPanettone said:

From the screenshot, I can see that the Objectspector is part of Scripter Studio. But can that ObjectInspector also be used as a component in your application?

Yes, form designer, object inspector, component combo, all can be used separately.

Share this post


Link to post
4 hours ago, Anders Melander said:

Are you sure about that?

Well, I was the one who made the agreement directly with Dmitry from Greatis. So yes, pretty sure. 🙂

Share this post


Link to post

Also worth mentioning from TMS is with the FNC UI pack you get an object inspector. Note in the documentation it calls out that you are inspecting published properties only. TMS FNC Object Inspector does not populate a tree of the application components, it is just the Inspector.

https://www.tmssoftware.com/site/tmsfncuipack.asp?s=fncobjectinspector#features

 

To your original question of all classes and objects, it is worth considering visibility and ownership.  The component tree is populated based forms / data modules owned by the application, then components owned by the form.  Consider if you are creating components at runtime and the owner is assigned to the form, if not then the component will not be visible.


I have used it to inspect some of by business objects, with the condition that the property is published.  It also has events so that you can make properties read only at runtime. Take a look through the PDF and see if it fits your needs.

 

If you desire a component tree you could build / buy something like my product,   I do not include a license to FNC UI pack, it is a separate purchase. Some youtube videos are available at https://swiftexpat.com that will give you an overview.

image.thumb.png.ad2afae0ab690eda52b2ecb61394bd33.png

 

  • Thanks 1

Share this post


Link to post

Important features of a Runtime Inspector would be:

• Retrieve any global variables, class field variables

• Any non-local expression (!)

Share this post


Link to post
1 hour ago, SwiftExpat said:

my product

As you have different Application tabs - how is the connection made between a running Application and your tool?

Share this post


Link to post

At runtime my component "Marshal" creates a form dedicated for inspection.  This is where you inspect and have access to the components.

 

My offline application "Caddie" captures your actions in Marshal and lets you review them later.  This is organized by application and is not connected to the runtime copy.

 

Together they make up the Runtime Toolkit.  The challenge I attempt to solve is documenting modifications at runtime so you can ensure the correct changes are made in your source code.  I like Marco's original tool, but I found myself not remembering what I modified to fix my issue.

 

I appreciate your features requirement clarification, but at this point I only do component inspection.

 

 

Share this post


Link to post
Posted (edited)
5 hours ago, SwiftExpat said:

At runtime my component "Marshal" creates a form dedicated for inspection.  This is where you inspect and have access to the components.

 

My offline application "Caddie" captures your actions in Marshal and lets you review them later.  This is organized by application and is not connected to the runtime copy.

 

Together they make up the Runtime Toolkit.  The challenge I attempt to solve is documenting modifications at runtime so you can ensure the correct changes are made in your source code.  I like Marco's original tool, but I found myself not remembering what I modified to fix my issue.

 

I appreciate your features requirement clarification, but at this point I only do component inspection.

 

That is an interesting concept. So I suppose in my Application, I would have to insert a small component (or create it dynamically) that creates a form holding the RunTime Inspector and maintains a mutual connection with that form? So when the Inspector asks for a specific (updated) component property or when my app has to change a property value, then this connection gets these things done? Is that correct?

Edited by PeterPanettone

Share this post


Link to post
11 hours ago, SwiftExpat said:

Also worth mentioning from TMS is with the FNC UI pack you get an object inspector

That is a different one. There is an object inspector control in FNC UI pack, which is cross-platform, and there is an object inspector in TMS Scripter, which is VCL-only. They have no code in common.

Share this post


Link to post
Posted (edited)
15 hours ago, PeterPanettone said:

I would have to insert a small component (or create it dynamically) that creates a form holding the RunTime Inspector and maintains a mutual connection with that form?

This is correct, you can see sample source code on Github here with compiled demos here. The component is a simple button which is appropriate for starting out. 

In an established application I take the approach to not use any extra space on the form by utilizing an onclick event handler of a label. The FMX sample shows a click 3 times on a label to invoke, similar to the 7 long presses in Android.  This design allows you to ifdef out the code for your release and not modify the form. Note the ifdefs in the samples.

15 hours ago, PeterPanettone said:

So when the Inspector asks for a specific (updated) component property or when my app has to change a property value, then this connection gets these things done? Is that correct? 

This is correct. This code maintains the tree of forms, data modules, components.  The Inspector loads the component details but is not automatically aware of changes that occur. On the Inspector tab there is a button that always allows you to reload.

 

In general workflow it stays up to date, but depending on what events are assigned on the component you may need to reload. An example would be modifying the align edit1 from center to client, The Inspector updates the align property because it is aware it made the change.  The width still shows 100 as in the Inspector because it is unaware of the new width due to alignment. A click on the reload button will force it to load the current values.

 

Edited by SwiftExpat
Better example case.
  • Thanks 1

Share this post


Link to post

There is also an object inspector component in the jvcl.

  • Thanks 1

Share this post


Link to post
On 7/24/2021 at 2:43 AM, Nigel Thomas said:

marco.cantu[at]embarcadero.com. He has contributed to this forum before so may respond to you here. You can find other ways to contact him via his website:

https://www.marcocantu.com/

Yes, I dwell here from time to time. I'll have a look, I know there are other tools doing the same but I'll update mine, should not be a big deal... time permitting.

  • Thanks 1

Share this post


Link to post

Marco, thank you very much! This is an invaluable debugging tool that saves me a lot of time.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×