简体   繁体   English

Delphi-对象属性的完整列表

[英]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. 对于某些特定对象,我希望等效于复制(作为文本)出现在Delphi的对象检查器中的属性和事件列表。

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. 据我所知,Object Inspector没有这种复制功能。 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). 对于它的价值,我有Delphi的1到7,2007年的XE,XE2和Tokyo(仅东京的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. 我认为gwideman正在寻求一种在Delphi的IDE中进行复制的方法,并且无需使用RTTI进行任何编码。

To an extend this is possible. 在某种程度上,这是可能的。 What you need to do is simply select an object and copy (Ctrl-C). 您只需要选择一个对象并复制(Ctrl-C)。 After that you can paste it to any text editor or even Excel. 之后,您可以将其粘贴到任何文本编辑器甚至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. 如果您需要已发布属性的完整列表,则可以在Delphi的帮助中轻松获取。 Like TSpeedButton . 就像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. 最后,如果右键单击表单,然后单击“以文本查看”,则可以获得表单及其所有对象的属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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