简体   繁体   中英

Delphi - comprehensive list of properties of object

For some particular object, I want the equivalent of copying (as text) the list of properties and events that appears in Delphi's Object Inspector.

My purpose is to be able to paste that into a spreadsheet, to be able to add notes to each item, add categorizations of properties that pertain to related functionality, or to compare to other objects (for example to align with inheritance ancestor or descendant).

So far as I know, Object Inspector doesn't have such a copy feature. So what's an alternative quick way to achieve this goal?

For what it's worth, I have Delphi's 1 through 7, 2007, XE, XE2, and Tokyo (of the latter, only Starter).

Clarification based on first few comments:

I do already know that items appearing on Object Inspector is the class's published properties, hence the information can be retrieved from the source files. However, the published properties may be distributed across multiple classes, and indeed multiple source files (due to inheritance), and the items themselves are not in a particularly convenient format. All surmountable. I simply hoped for a faster easier method, given that the Object Inspector's display is already so close to what I was looking for.

Since I don't have enough reputation to comment, I am writing this as an answer. I think gwideman is asking for a way to copy inside Delphi's IDE, and without any coding with RTTI.

To an extend this is possible. What you need to do is simply select an object and copy (Ctrl-C). After that you can paste it to any text editor or even Excel. It should be something like this:

object Button1: TButton
  Left = 60
  Top = 510
  Width = 80
  Height = 25
  Anchors = [akLeft, akBottom]
  Caption = 'Save'
  Enabled = False
  TabOrder = 0
  OnClick = Button1Click
end

Notice that even the event handlers are included.

You may also notice that the list is rather short. This is because properties that have the default values are skipped. This can be a problem if you need all properties. But if you just want to comment your settings this saves time and is the best.

If you need the whole list of published properties, you can easily get it in Delphi's help. Like TSpeedButton .

Finally, if you right-click on the form and click "View as Text", you can get the properties of the form and all its objects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM