Delphi: keystroke or IDE option to populate interface elements on a class

百般思念 提交于 2019-12-10 03:07:29

问题


I am looking for any IDE menu option, keystroke, shorcut, mouse clicks or something to populate all interface elements (methods, properties, etc) inside a class implementing it.

Are there any way to do it ?


回答1:


There is no such shortcut, sadly.

A rather similar question was asked recently here: How to automatically implement inherited abstract methods in Delphi XE




回答2:


There is a shortcut that will let you autocomplete your class: Ctrl + Shift + C will autocomplete your functions, procedures and properties...

example:

inside the class write "procedure myproc;" then type Ctrl+Shift+C and Delphi will create the procedure body.

if you type "property myprop:String;" and then type Ctrl+Shift+C Delphi will create the get and set functions for your property.

Another good shortcut is Ctrl+Shift+Up to go to the procedure/function declaration and Ctrl+Shift+Down to go to the procedure/function implementation.

Hope that helps.




回答3:


The OmniPascal plugin for Visual Studio Code does support this feature.

If you have a correct setup then you will see a green line marking all incomplete interfaces of a class. Clicking the lightbulb (or pressing CTRL+. when the cursor is placed inside the name of the interface) it will generate the code stub for this interface.




回答4:


Delphi itself doesn't have a shortcut for this, but Modelmaker Code Explorer allows you to have a class implement an interface including generating all the empty method stubs.



来源:https://stackoverflow.com/questions/5770200/delphi-keystroke-or-ide-option-to-populate-interface-elements-on-a-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!