[DUG] D2009 or later version suggestion....

Jeremy North jeremy.north at gmail.com
Fri Dec 12 13:19:50 NZDT 2008


> Also many of the power features of the standard IDE are very hard to
> discover.....for instance although I have seen others demonstrate declaring
> a local variable while writing code in D2006/D2007, I have never yet found
> out how to do it.

It is a template.

In a method
Press Ctrl+Space
Type in var and hit enter

You should now have the following inserted
  LVar: Integer;

Where LVar will be highlighted. Type in your variable name and press
Tab (or Enter if it is an integer), then enter in the type and press
enter (or tab).

I prefer to use the Declare variable refactoring where you type in
your code as usual and then use Shift+Ctrl+V on the variable name to
declare it locally or Shift+Ctrl+D to declare in in the interface
section of the class.

The reason you have to use Ctrl+Space is because the template is only
available using manual invoking. You can change it to invoke
automatically but that would drive you nuts with the template being
used when you don't really want it to. You could easily rename the
template to something else (such as va) and set that template to
"auto" invoking. To see other templates you can use the View |
Templates command.

I wrote an expert for creating and editing templates, just never got
around to publishing it. If you have questions on templates, I
_should_ be able to answer them.

cheers,
Jeremy


More information about the Delphi mailing list