5

Is it possible to let the IDE automatically implement inherited abstract methods in Delphi XE? In Java and C# IDEs it's a common functionality like pressing ALT+SHIFT+F10 in Visual Studio or ALT+RETURN in IntelliJ IDEA.

Without this I always have to look up manually which methods have to be implemented and copy their declarations, which really is something I shouldn't have to do nowadays!

Bunkerbewohner
  • 622
  • 9
  • 20

2 Answers2

10

You can use ctrl+space in the class declaration to get a list of all the methods you might want to override (or implement from an interface). It does however not tell you which is abstract but once you figured that out you will get the declaration for free by selecting the method(s) from the list. And after that you can of course use class completion ctrl+shift+c to generate the code in implementation section.

Mikael Eriksson
  • 136,425
  • 22
  • 210
  • 281
  • Thanks, this is the closest I can get with Delphi, I suppose. – Bunkerbewohner Mar 14 '11 at 23:38
  • 5
    The list of overridable methods supports multiselection, so you can select methods you want to override, press Enter, and they will be added to both your class interface and implementation. – Ondrej Kelle Mar 15 '11 at 09:08
2

No, the Delphi IDE doesn't have an automatic shortcut for this. But, you can use the compiler to make it easier on you.

Define your new class. Then put a line somewhere in your code that says TMyNewClass.Create(whatever). When the compiler parses this, if there are any unimplemented abstract methods on TMyNewClass, it will tell you about them in the compiler warnings.

Mason Wheeler
  • 82,511
  • 50
  • 270
  • 477