1. Getting Started
1.1 Obtaining Tcl/Tk
1.2 Interactive Execution
1.3 Direct Execution
1.4 Reading this Book
1.5 Requirements for Networking Examples
1.6 Requirements for the C/C++ Connection
1.7 Tcl/Tk Version Requirements
2. Basic Syntax and I/O
2.1 The Form of a Tcl Script
2.2 Variables in Tcl
2.3 Copying a File Line by Line
2.4 While Loop
2.5 Curly Brackets
2.6 Double Quotes
2.7 Command Substitution
2.8 Opening Files
2.9 Completed File Copying Example
2.10 More about Substitution
2.11 Solutions to Exercises
3. Expressions and Branching
3.1 Expressions
3.2 Branching
3.3 Math Functions
3.4 Solutions to Exercises
4. Procedures
4.1 Procedures
4.2 Global and Local Variables
4.3 Passing Arguments by Reference
4.4 Default Values for Parameters
4.5 Reimplementing Procedures
4.6 Regional Variables
4.7 Action Families
4.8 An Example Action Family
4.9 Implementing Action Families in Earlier Versions of Tcl
4.10 Error Handling
4.11 Procedures Defining Procedures
4.12 Solutions to Exercises
5. Data Structures and Iteration
5.1 Associative Arrays and the Concept of Function
5.2 Using Arrays for Missing Features
5.3 Procedures for Working with Arrays
5.4 The scan and format Procedures
5.5 Lists
5.6 An Action Family for Working with Lists
5.7 Lists Support Flexible Argument Usage
5.8 Switches and Options
5.9 Iteration
5.10 Indexing Web Sites
5.11 Solutions to Exercises
6. Strings, Files, and Glob Pattern Matching
6.1 The string Action Family
6.2 The file Action Family
6.3 The info Action Family
6.4 Glob Patterns
6.5 Commands Accepting Glob Patterns
6.6 Developing for Multiple Platforms
6.7 A Virtual Machine
6.8 Solutions to Exercises
7. Regexp and Regsub
7.1 Theory and Practice
7.2 Character Set, Quoting, and Style
7.3 Regular-Expression versus Glob Patterns
7.4 Repetitions and Branches
7.5 Use Parentheses to Build more Complicated Patterns
7.6 Use Parentheses to Extract Subpatterns
7.7 Search and Replace
7.8 Style Review
7.9 Solutions to Exercises
8. Tcl Odds and Ends
8.1 Starting Processes and Pipes
8.2 More about I/O
8.3 More about Variables
8.4 The clock Action Family
8.5 Building Command Lines
8.6 Object Action Families
8.7 Executing Scripts from within Scripts
8.8 Interpreter Hierarchies
8.9 Delaying Execution
8.10 Performance Testing
8.11 The Current Directory
8.12 Binary Data
8.13 Solutions to Exercises
9. More about Procedures
9.1 Packages and Automatically Sourcing Procedures
9.2 Loading Procedures in Binary Form
9.3 On Control Structures
9.4 Example Control Structure
9.5 Solutions to Exercises
10. TCP/IP Networks and Event-Driven Programming
10.1 TCP/IP Networks as Seen from Tcl
10.2 The World Wide Web as a Client/Server Application
10.3 Creating a Web Client in Tcl
10.4 The Event Loop
10.5 Timeouts
10.6 Background Error Handling
10.7 Client/Server the Tcl Way
10.8 More about the Event Loop
10.9 The http Package
10.10 A Brief HTML Introduction
10.11 Solutions to Exercises
11. Overview of Tk
11.1 Starting with Tk
11.2 The Tk Way of Thinking
11.3 Details of the Caps Example
11.4 Enhancing Caps with Tab
11.5 Cleaning Up the Root Window
11.6 Multiplatform Caveat
11.7 Solutions to Exercises
12. Widget Characteristics
12.1 Focus
12.2 Size
12.3 Frames, the Archetypal, No-Frills Widgets
12.4 Colors
12.5 Fonts
12.6 Mouse Cursor
12.7 Common Options
12.8 Solutions to Exercises
13. Geometry Management
13.1 The pack and grid Action Families
13.2 Slicing
13.3 Slicing for Size Changes
13.4 Padding
13.5 An Array of Cells
13.6 The Cavity
13.7 Placing Widgets more Carefully
13.8 Tricks for Using Pack
13.9 Solutions to Exercises
14. Some Basic Widget Types
14.1 Labels
14.2 Buttons
14.3 Entries
14.4 Images
14.5 Widget Padding
14.6 Active/Normal/Disabled
14.7 Selection
14.8 Solutions to Exercises
15. List of Widget Types
15.1 Button
15.2 Canvas
15.3 Checkbutton
15.4 Entry
15.5 Frame
15.6 Label
15.7 Listbox
15.8 Menu and Menubutton
15.9 Message
15.10 Radiobutton
15.11 Scale
15.12 Scrollbar
15.13 Text
15.14 Toplevel
15.15 Exercises
15.16 Solutions to Exercises
16. Bindings
16.1 User Events
16.2 Getting Information to Event Handlers
16.3 Bindings
16.4 More about Bindings
16.5 Timing
16.6 Solutions to Exercises
17. Partially Displayed Widgets
17.1 Listboxes
17.2 Scrollbars
17.3 Menus and Menubuttons
17.4 Option Menus
17.5 Solutions to Exercises
18. Text Widgets
18.1 A Multiline Entry Widget and More
18.2 Marks and Indexing
18.3 Text Tags
18.4 Tag Subactions
18.5 Tag Options
18.6 Embedded Widgets
18.7 Solutions to Exercises
19. Canvases
19.1 Introduction, Subwindows, and Scrolling
19.2 Anchoring and Discrete Scrolling
19.3 A Script for Examining Canvas Items
19.4 The Oval is a Typical Item
19.5 Canvas Tags
19.6 A Tour of Canvas Items
19.7 Changing Option Values
19.8 Moving Items
19.9 Identifying an Item or Tagged Set under the Mouse
19.10 Canvas-Object Actions
19.11 PostScript
19.12 Implementing the Item Examining Script
19.13 Solutions to Exercises
20. Tk Odds and Ends
20.1 The winfo Action Family
20.2 The wm Action Family
20.3 Cutting and Pasting
20.4 Asserting Primacy among Windows
20.5 A New Command Window
20.6 Solutions to Exercises
21. The Browser Plugin and Safe-Tcl
21.1 The Tcl/Tk Plugin
21.2 Combining Features into Policies
21.3 Writing Tclets
21.4 Customizing Slave Interpreters
21.5 Safe-Tcl
21.6 Solutions to Exercises
22. The C/C++ Connection
22.1 Data Types in Transition
22.2 C Procedures that Run as Tcl/Tk Commands
22.3 Naming Conventions
22.4 Registering Commands
22.5 Extending Tcl with the Recompile/Relink Method
22.6 Extending Tcl with the Load Method
22.7 Creating Math Functions
22.8 Tk
22.9 Solutions to Exercises
23. Essential Library Functions
23.1 Allocating Memory
23.2 Manipulating Objects of Type Tcl_Obj
23.3 More about Command Execution
23.4 Accessing Tcl Variables
23.5 List Processing
23.6 Solutions to Exercises
24. Some Useful Library Functions
24.1 Checking Arguments
24.2 Dynamic Strings
24.3 Pattern Matching
24.4 Associative Arrays
24.5 Multiple Associative Arrays
24.6 Solutions to Exercises
25. Creating Tcl Objects in C/C++
25.1 Object Orientation in C
25.2 Object Orientation in Tcl
25.3 Implementing Object Actions
25.4 Implementing Class Actions
25.5 Commands that Work with Multiple Objects
25.6 Solutions to Exercises