Using Code Folding

From RAD Studio
Jump to: navigation, search

Go Up to How To Edit Code in the Code Editor

Code folding lets you collapse (hide) and expand (show) your code to make it easier to navigate and read. RAD Studio generates code that contains code folding regions, but you can add your own regions as needed. Code folding is on by default.

To disable/enable code folding

  • To disable/enable code folding for the current session and subsequent sessions, use the Code Folding option on the Tools > Options > Editor Options dialog box.
  • To disable/enable code folding for the current edit session, press and hold Ctrl+Shift K+O.

To collapse code

  • In the Code Editor, click the minus (-) sign to the left of a code block.
  • Press and hold Ctrl+Shift K+E to collapse the nearest code block.

To expand code

  • In the Code Editor, click the plus (+) sign to the left of a collapsed code block.
  • Press and hold Ctrl+Shift K+U to expand the nearest code block.
  • Press and hold Ctrl+Shift K+A to expand all code.

To add a code folding region

In the Code Editor, use the following preprocessor directives to surround a block of code:

{$region 'Optional text that appears when the code block is folded'}
.
.
.
{$endregion}
#region Optional text that appears when the code block is folded
.
.
.
#endregion 
#pragma region optional text
.
.
.
#pragma end_region 

The region is marked with a minus (-) sign.

See Also

Personal tools
Newest Version: XE
In other languages