Previous Application Programming: Creating and Running Programs in IDL Next

Maximizing the Editor's Capabilities

Although any text editor can be used to create an IDL program file, the IDL Editor included in the IDL Development Environment contains features that simplify the process of writing IDL code. For example, if you indent a line using the Tab key, the following lines will be indented as well.

If you click the right mouse button while positioned over an editor window, a context menu appears allowing you to quickly access several of the most convenient commands. The context menu changes to display common debugging commands if IDL is running a program. When you create programs in the Editor window, you also have access to the following features:

If a program error or breakpoint is encountered, IDLDE displays the relevant file, opening it if necessary. The line at which the breakpoint or error occurred is marked. See Debugging and Error-Handling for more on IDL's debugging commands.

If you use the IDL Development Environment, files are opened in the IDL Editor by default. On UNIX platforms, you can simplify the process of using another editor; see Creating a Macro to Call a Text Editor in IDL for UNIX for details.

If you have a file open in the IDL Editor and you modify the file using another editor (on any platform), IDL will warn you that the file in the IDL Editor window has changed, and give you a chance to reload the file.

Navigating Among Procedures and Functions

When you open a file in the IDL Editor, all functions and procedures defined in that file are listed in the Functions/Procedures Menu. On Windows, this feature appears as a pull-down menu located on the IDLDE toolbar. On Motif, this menu is accessed through the () button in the upper left corner of the Editor window.

Select a procedure or function from the drop-down list to move the cursor to the beginning of that procedure or function. This is especially useful for navigating large program files containing multiple procedures and functions.

Figure 2-1: Function/Procedure Menu

Figure 2-1: Function/Procedure Menu

Commenting Blocks of Code

The IDLDE provides methods to quickly comment and uncomment blocks of code lines. To comment or uncomment lines of code, you may either select the lines to be commented/uncommented or you may simply places the cursor somewhere on the desired line. Commenting and uncommenting can be performed using:

Table 2-2: Block Comment Methods

Table 2-2: Block Comment Methods
Method
Description
Toolbar
Click the Comment or Uncomment toolbar items.
Menu
Use the Edit Comment or Edit Uncomment menu items.
Context menu
Right click over a line (or block of selected lines) to display the context menu. Select Comment or Uncomment.

Searching

The IDL Editor window provides a comprehensive search-and-replace mechanism, allowing you to search for occurrences of a text string in one or more open files. See Search Menu for details.

Changing Text Selection Modes (Windows Only)

Under Microsoft Windows, the IDL Editor provides three ways of selecting text: stream mode, line mode, and column mode.

Switch between the three modes by clicking the right mouse button while positioned over an Editor window. Select the "Selection Mode" option to access a pull-down menu with the three text selection modes. The option with a check mark by it is the currently selected text selection mode. If you have text already selected, the selected area will change to reflect the new mode.

Modifying Chromacoding (Windows Only)

The IDL Editor in IDL for Windows supports chromacoding — different types of IDL statements appear in different colors. To change the default colors used for different types of IDL statements, select File  Preferences, and select the Editor tab.

Turning Chromacoding Off

By default, the Windows IDL Editor uses chromacoding. To turn off chromacoding, select File Preferences, select the Editor tab, and uncheck the Enable colored syntax checkbox. Alternately, you can specify a

Editor Window Keyboard Shortcuts

The IDL Editor window supports a number of useful keyboard shortcuts, described in the following table.


Note
See Enabling Alt Key Accelerators on Macintosh for information on using keyboard accelerators on the Macintosh platform.

Table 2-3: IDL Editor Window Key Definitions 

Table 2-3: IDL Editor Window Key Definitions 
Key
(Windows)
Key
(Motif)
Action
 
 
Move cursor left or right one character, up or down one line.
Ctrl+
Ctrl+B
Move left one word.
Ctrl+
Ctrl+F
Move right one word.
End
Ctrl+E
Move to end of current line.
Home
Ctrl+A or Home
Move to beginning of current line.
Page Down
Page Down
Move to next screen.
Page Up
Page Up
Move to previous screen.
Shift+Tab
 
Move cursor one tab-stop left.
Ctrl+Home
Ctrl+Home
Move to beginning of file.
Ctrl+End
Ctrl+End
Move to end of file.
 
Ctrl+V
Delete word to the left of the cursor.
Ctrl+K
 
Delete word to the right of the cursor.
 
Ctrl+K
Delete everything in the current line to the right of the cursor.
 
Ctrl+U
Delete everything in the current line to the left of the cursor.
Delete
Ctrl+D
Delete the next character.
Ctrl+U
 
Make selected text (or the character to the right of the cursor) lower-case.
Ctrl+Shift+U
 
Make selected text (or the character to the right of the cursor) upper-case.
Ctrl+Z
Alt+Z
Undo last action.
Ctrl+Y
Alt+Y
Redo last undone action.
Ctrl+X
Alt+X
Cut selection to clipboard.
Ctrl+Shift+Y
 
Cut line containing cursor to clipboard.
Ctrl+C
Alt+C
Copy selection to clipboard.
Ctrl+V
Alt+V
Paste contents of clipboard at current cursor location.
Ctrl+]
 
Find matching (, {, or [character.
Tab
 
Indent highlighted lines one tab-stop right.

  IDL Online Help (March 06, 2007)