Tcl Tutorial

 

Table of Contents

Analyzing the Program

Introduction

In this step, you will examine the Tcl program on a line-by-line basis. Ensure that Line Numbers are enabled in Komodo (View|View Line Numbers). Ensure that the file dlg_tcl_check.tcl is displayed in the Komodo Editor Pane.

Setting Up the Program

Line 1 - Path to Tcl Interpreter

  • begins the Tcl program
  • associates the program with a Tcl interpreter (in this case, ...)

Komodo Tip notice that syntax elements are displayed in different colors. You can adjust the display options for language elements in the Preferences dialog box.

Lines 12 - Package Require Command

  • specifies the package required for the application
  • Provides a library of support scripts that loads procedures as necessary
  • The "package require" is usually accompanied by a name and version number (in this case, Tk 8.3).
Top

Writing the Output Header

Line 15 - Declaring the Namespace

Perl Pointer scalar variables store "single" items; their symbol ("$") is shaped like an "s", for "scalar".

Line 18 - Source the ".ui" File

Top

Callback Code

Lines 34 to 40 - Checkbutton Proc

Perl Pointer good Perl code is liberally annotated with comments (indicated by the "#" symbol).

Line 49 - Freedom Command Argument Proc

Top

Starting the Processing Loop

Line 58 - Liberty Command Argument Proc

Komodo Tip Click on the minus symbol to the left of line 21. The entire section of nested code will be collapsed. This is Code Folding.

Komodo Tip click the mouse pointer on line 21. Notice that the opening brace changes to a bold red font. The closing brace on line 51 is displayed the same way.

Line 67 - Radio Command Argument

Perl Pointer variable arrays store lists of items indexed by number; their symbol ("@") is shaped like an "a", for "array".

Top

Converting Characters with a Regular Expression

Lines 76 to 78 - Userinit Arguments

Komodo Tip Komodo's Rx Toolkit is a powerful tool for creating and debugging regular expressions. See Introduction to Regular Expressions for more information.

Top

SOME OTHER SECTION

Lines 93 to 110 - Initialization Root Arguments Proc

Tcl Tip variable hashes are indicated by the symbol "%", and store lists of items indexed by string.

Top
Top Previous Next