Google
 

Monday, November 1, 2010

Delphi Basics hints and tips

Delphi Basics hints and tips




The idea of this page is to collect together in one place small, but eminently useful aids to efficient and productive programming in Delphi.

This list will start small, and grow with just the best hints and tips. Alternatively, you can look in Delphi help - for example, type in Shortcuts in the Find tab.



Feel free to contact the author to add to the list here - your suggestions are more than welcome.





Editor shortcuts



Shortcut Keys Resulting actions



Alt + BlockSelect Allows column constrained selection of a text block.

Normally, when you select more than one line using the mouse (by dragging with the left mouse button down) or the arrow keys (with shift held down), the text on the middle lines is always the whole line.



By holding down the Alt key before doing starting the selection, you mark just a vertical block of text. (You can release the Alt key as soon as you have started marking).



When you insert the copied block, it will insert the text where the cursor is positioned, but will not create new lines. It effectively inserts horizontally, but not vertically. The best way to see the effect is to try it!





Ctrl + Shift + i Block Indent. Indents a block of text (lines or Alt-selection) by the tab amount.



Ctrl + Shit + u Block UnIndent. UnIndents a block of text (lines or Alt-selection) by the tab amount.



Ctrl + Shift

+ UpArrow Switch between routine definition and implementation.

Position the cursor on the line of a function or procedure in the interface part of your unit, and this key combination will move to the implementation. And vice versa.





Ctrl + Shift + c Code completion

Position the cursor at a new function or procedure definition, and this key combination will create the code skeleton, and move the cursor into the begin block ready for typing.





Ctrl + Shift + r Macro record

Records the subsequent mouse and key actions as a macro. Finish with the same key combination.





Ctrl + Shift + p Macro play

Plays the last recorded macro.





Ctrl + e Incremental search. The letters you subsequently type form a search string. As you type, it moves to the first part of the current file that matches the string.

It is not case sensitive. Press Escape to stop searching.