Tcl Tutorial

 

Table of Contents

Using Tcl Editing Features

All of Komodo's editing features are available when you are coding in Tcl. The examples and simple exercises below provide an introduction to these features.

Syntax Coloring

Komodo detects keywords in your code and applies coloring that makes it easier to quickly identify specific elements. For example, in dlg_tcl_check.tcl, on line 36, notice that the "set" command is a different color from the strings "normal" and "disabled". You can specify coloring for these and many other Tcl elements with the Fonts and Colors Preferences (Edit|Preferences|Fonts and Colors).

Top

AutoComplete and CallTips

Komodo helps to make coding faster by displaying available methods for Tcl commands. Komodo also shows you the list of arguments you can pass to a function you are calling.

  1. On a blank, uncommented line in dlg_tcl_check.tcl, enter the following code:

    str

    After you type the "r", Komodo lists the methods that start with "str". Use the mouse or the up and down arrow keys to scroll through list.


  2. Continue typing until your entry reads:

    string is

    Notice that the list reduces to the available methods only. You can move through the list using the mouse or the up and down arrow keys.


  3. From the drop-down list, select "string is alnum" and press the Tab key. Komodo completes the rest of the method name. This is AutoCompletion.


  4. Type a space after "string is alnum". Komodo lists the arguments for calling the string. This is CallTips.
Top

Background Syntax Checking

Komodo checks for syntax errors in your Tcl code as you type. Komodo informs you of these errors by displaying red and green squiggly lines below the code. Syntax errors are underlined with a red squiggly line; syntax warnings are underlined with a green squiggly line. Notice that the text you typed in the previous step, "string is alnum," is underlined with a red squiggle. Position your cursor on the line with the squiggle to display a warning message on the status bar.

Delete "string is alnum".

Top

Code Folding

You can collapse and expand blocks of code to make it easier to view or analyze the structure of your code.

  1. On line 93, click the "-" sign to the left of the Komodo Editor Pane to collapse this block of code. Notice that the "-" sign becomes a "+" sign.
  2. Click the "+" sign. The block of text will be expanded again.

Top Previous Next