| |  | Copyright |
| |  | List of Examples |
| |  | List of Tables |
| |  | Preface |
| |
|  | Why Tcl? |
| |
|  | Tcl and Tk Versions |
| |
|  | Extending Tcl and Tk |
| |
|  | Tcl on the World Wide Web |
| |
|  | Ftp Archives |
| |
|  | Newsgroups |
| |
|  | Who Should Read This Book |
| |
|  | How to Read This Book |
| |
|  | On-line Examples |
| |
|  | Typographic Conventions |
| |
|  | Hot Tips |
| |
|  | Book Organization |
| |
|  | What's New in the Fourth Edition |
| |
|  | Other Tcl Books |
| |
|  | First Edition Thanks |
| |
|  | Second Edition Thanks |
| |
|  | Third Edition Thanks |
| |
|  | Fourth Edition Thanks |
| |
|  | Contact the Author |
 |
| |  | Part I.
Tcl Basics |
| |
|  | Chapter 1.
Tcl Fundamentals |
| |
|  | Tcl Commands |
| |
|  | Hello, World! |
| |
|  | Variables |
| |
|  | Command Substitution |
| |
|  | Math Expressions |
| |
|  | Backslash Substitution |
| |
|  | Grouping with Braces and Double Quotes |
| |
|  | Procedures |
| |
|  | A Factorial Example |
| |
|  | More about Variables |
| |
|  | More about Math Expressions |
| |
|  | Comments |
| |
|  | Substitution and Grouping Summary |
| |
|  | Fine Points |
| |
|  | Reference |
 |
| |
|  | Chapter 2.
Getting Started |
| |
|  | The source Command |
| |
|  | UNIX Tcl Scripts |
| |
|  | Windows Start Menu |
| |
|  | Macintosh OS 8/9 and ResEdit |
| |
|  | The console Command |
| |
|  | Command-Line Arguments |
| |
|  | Predefined Variables |
 |
| |
|  | Chapter 3.
The Guestbook CGI Application |
| |
|  | A Quick Introduction to HTML |
| |
|  | CGI for Dynamic Pages |
| |
|  | The guestbook.cgi Script |
| |
|  | Defining Forms and Processing Form Data |
| |
|  | Handling Errors in CGI Scripts |
| |
|  | Next Steps |
 |
| |
|  | Chapter 4.
String Processing in Tcl |
| |
|  | The string Command |
| |
|  | The append Command |
| |
|  | The format Command |
| |
|  | The scan Command |
| |
|  | The binary Command |
| |
|  | Related Chapters |
 |
| |
|  | Chapter 5.
Tcl Lists |
| |
|  | Tcl Lists |
| |
|  | Constructing Lists |
| |
|  | Getting List Elements: llength, lindex, and lrange |
| |
|  | Modifying Lists: linsert and lreplace |
| |
|  | Searching Lists: lsearch |
| |
|  | Sorting Lists: lsort |
| |
|  | The split Command |
| |
|  | The join Command |
| |
|  | Related Chapters |
 |
| |
|  | Chapter 6.
Control Structure Commands |
| |
|  | If Then Else |
| |
|  | Switch |
| |
|  | While |
| |
|  | Foreach |
| |
|  | For |
| |
|  | Break and Continue |
| |
|  | Catch |
| |
|  | Error |
| |
|  | Return |
 |
| |
|  | Chapter 7.
Procedures and Scope |
| |
|  | The proc Command |
| |
|  | Changing Command Names with rename |
| |
|  | Scope |
| |
|  | The global Command |
| |
|  | Call by Name Using upvar |
| |
|  | Variable Aliases with upvar |
 |
| |
|  | Chapter 8.
Tcl Arrays |
| |
|  | Array Syntax |
| |
|  | The array Command |
| |
|  | Building Data Structures with Arrays |
 |
| |
|  | Chapter 9.
Working with Files and Programs |
| |
|  | Running Programs with exec |
| |
|  | The file Command |
| |
|  | Cross-Platform File Naming |
| |
|  | Manipulating Files and Directories |
| |
|  | File Attributes |
| |
|  | Input/Output Command Summary |
| |
|  | Opening Files for I/O |
| |
|  | Reading and Writing |
| |
|  | The Current Directory — cd and pwd |
| |
|  | Matching File Names with glob |
| |
|  | The exit and pid Commands |
| |
|  | Environment Variables |
| |
|  | The registry Command |
 |
 |
| |  | Part II.
Advanced Tcl |
| |
|  | Chapter 10.
Quoting Issues and Eval |
| |
|  | Constructing Code with the list Command |
| |
|  | Exploiting the concat inside eval |
| |
|  | The uplevel Command |
| |
|  | The subst Command |
 |
| |
|  | Chapter 11.
Regular Expressions |
| |
|  | When to Use Regular Expressions |
| |
|  | Regular Expression Syntax |
| |
|  | Advanced Regular Expressions |
| |
|  | Syntax Summary |
| |
|  | The regexp Command |
| |
|  | The regsub Command |
| |
|  | Transforming Data to Program with regsub |
| |
|  | Other Commands That Use Regular Expressions |
 |
| |
|  | Chapter 12.
Script Libraries and Packages |
| |
|  | Locating Packages: The auto_path Variable |
| |
|  | Using Packages |
| |
|  | Summary of Package Loading |
| |
|  | The package Command |
| |
|  | Libraries Based on the tclIndex File |
| |
|  | The unknown Command |
| |
|  | Interactive Conveniences |
| |
|  | Tcl Shell Library Environment |
| |
|  | Coding Style |
 |
| |
|  | Chapter 13.
Reflection and Debugging |
| |
|  | The clock Command |
| |
|  | The info Command |
| |
|  | Cross-Platform Support |
| |
|  | Tracing Variables and Commands |
| |
|  | Interactive Command History |
| |
|  | Debugging |
| |
|  | Tcl Dev Kit |
| |
|  | Other Tools |
| |
|  | Performance Tuning |
 |
| |
|  | Chapter 14.
Namespaces |
| |
|  | Using Namespaces |
| |
|  | Namespace Variables |
| |
|  | Command Lookup |
| |
|  | Nested Namespaces |
| |
|  | Importing and Exporting Procedures |
| |
|  | Callbacks and Namespaces |
| |
|  | Introspection |
| |
|  | The namespace Command |
| |
|  | Converting Existing Packages to use Namespaces |
| |
|  | [incr Tcl] Object System |
| |
|  | xotcl Object System |
| |
|  | Notes |
 |
| |
|  | Chapter 15.
Internationalization |
| |
|  | Character Sets and Encodings |
| |
|  | Message Catalogs |
 |
| |
|  | Chapter 16.
Event-Driven Programming |
| |
|  | The Tcl Event Loop |
| |
|  | The after Command |
| |
|  | The fileevent Command |
| |
|  | The vwait Command |
| |
|  | The fconfigure Command |
 |
| |
|  | Chapter 17.
Socket Programming |
| |
|  | Networking Extensions for Tcl |
| |
|  | Client Sockets |
| |
|  | Server Sockets |
| |
|  | The Echo Service |
| |
|  | Fetching a URL with HTTP |
| |
|  | The http Package |
| |
|  | Basic Authentication |
 |
| |
|  | Chapter 18.
TclHttpd Web Server |
| |
|  | Integrating TclHttpd with Your Application |
| |
|  | Domain Handlers |
| |
|  | Application Direct URLs |
| |
|  | Document Types |
| |
|  | HTML + Tcl Templates |
| |
|  | Form Handlers |
| |
|  | Programming Reference |
| |
|  | Standard Application Direct URLs |
| |
|  | The TclHttpd Distribution |
| |
|  | Server Configuration |
 |
| |
|  | Chapter 19.
Multiple Interpreters and Safe-Tcl |
| |
|  | The interp Command |
| |
|  | Creating Interpreters |
| |
|  | Safe Interpreters |
| |
|  | Command Aliases |
| |
|  | Hidden Commands |
| |
|  | Substitutions |
| |
|  | I/O from Safe Interpreters |
| |
|  | The Safe Base |
| |
|  | Security Policies |
 |
| |
|  | Chapter 20.
Safe-Tk and the Browser Plugin |
| |
|  | Tk in Child Interpreters |
| |
|  | The Browser Plugin |
| |
|  | Security Policies and Browser Plugin |
| |
|  | Configuring Security Policies |
 |
| |
|  | Chapter 21.
Multi-Threaded Tcl Scripts |
| |
|  | What are Threads? |
| |
|  | Thread Support in Tcl |
| |
|  | Getting Started with the Thread Extension |
| |
|  | Sending Messages to Threads |
| |
|  | Preserving and Releasing Threads |
| |
|  | Error Handling |
| |
|  | Shared Resources |
| |
|  | Managing I/O Channels |
| |
|  | Shared Variables |
| |
|  | Mutexes and Condition Variables |
| |
|  | Thread Pools |
| |
|  | The Thread Package Commands |
 |
| |
|  | Chapter 22.
Tclkit and Starkits |
| |
|  | Getting Started with Tclkit |
| |
|  | Virtual File Systems |
| |
|  | Using sdx to Bundle Applications |
| |
|  | Exploring the Virtual File System in a Starkit |
| |
|  | Creating tclhttpd.kit |
| |
|  | Creating a Shared Starkit |
| |
|  | Metakit |
| |
|  | More Ideas |
 |
 |
| |  | Part III.
Tk Basics |
| |
|  | Chapter 23.
Tk Fundamentals |
| |
|  | Hello, World! in Tk |
| |
|  | Naming Tk Widgets |
| |
|  | Configuring Tk Widgets |
| |
|  | Tk Widget Attributes and the Resource Database |
| |
|  | Summary of the Tk Commands |
| |
|  | Other Widget Sets |
 |
| |
|  | Chapter 24.
Tk by Example |
| |
|  | ExecLog |
| |
|  | The Example Browser |
| |
|  | A Tcl Shell |
 |
| |
|  | Chapter 25.
The Pack Geometry Manager |
| |
|  | Packing toward a Side |
| |
|  | Horizontal and Vertical Stacking |
| |
|  | The Cavity Model |
| |
|  | Packing Space and Display Space |
| |
|  | Resizing and -expand |
| |
|  | Anchoring |
| |
|  | Packing Order |
| |
|  | Choosing the Parent for Packing |
| |
|  | Unpacking a Widget |
| |
|  | Packer Summary |
| |
|  | Window Stacking Order |
 |
| |
|  | Chapter 26.
The Grid Geometry Manager |
| |
|  | A Basic Grid |
| |
|  | Spanning Rows and Columns |
| |
|  | Row and Column Constraints |
| |
|  | The grid Command |
 |
| |
|  | Chapter 27.
The Place Geometry Manager |
| |
|  | place Basics |
| |
|  | The Pane Manager |
| |
|  | The place Command |
 |
| |
|  | Chapter 28.
The Panedwindow Widget |
| |
|  | Using the Panedwindow |
| |
|  | Programming Panedwindow Widgets |
| |
|  | Panedwindow Attributes |
 |
| |
|  | Chapter 29.
Binding Commands to Events |
| |
|  | The bind Command |
| |
|  | The bindtags Command |
| |
|  | Event Syntax |
| |
|  | Modifiers |
| |
|  | Event Sequences |
| |
|  | Virtual Events |
| |
|  | Generating Events |
| |
|  | Event Summary |
 |
 |
| |  | Part IV.
Tk Widgets |
| |
|  | Chapter 30.
Buttons and Menus |
| |
|  | Button Commands and Scope Issues |
| |
|  | Buttons Associated with Tcl Variables |
| |
|  | Button Attributes |
| |
|  | Button Operations |
| |
|  | Menus and Menubuttons |
| |
|  | Menu Bindings and Events |
| |
|  | Manipulating Menus and Menu Entries |
| |
|  | Menu Attributes |
| |
|  | A Menu by Name Package |
 |
| |
|  | Chapter 31.
The Resource Database |
| |
|  | An Introduction to Resources |
| |
|  | Loading Option Database Files |
| |
|  | Adding Individual Database Entries |
| |
|  | Accessing the Database |
| |
|  | User-Defined Buttons |
| |
|  | User-Defined Menus |
 |
| |
|  | Chapter 32.
Simple Tk Widgets |
| |
|  | Frames, Labelframes, and Toplevel Windows |
| |
|  | The Label Widget |
| |
|  | The Message Widget |
| |
|  | The Scale Widget |
| |
|  | The bell Command |
 |
| |
|  | Chapter 33.
Scrollbars |
| |
|  | Using Scrollbars |
| |
|  | The Scrollbar Protocol |
| |
|  | The Scrollbar Widget |
 |
| |
|  | Chapter 34.
The Entry and Spinbox Widgets |
| |
|  | Using Entry Widgets |
| |
|  | Using Spinbox Widgets |
| |
|  | Entry and Spinbox Bindings |
| |
|  | Entry and Spinbox Attributes |
| |
|  | Programming Entry and Spinbox Widgets |
 |
| |
|  | Chapter 35.
The Listbox Widget |
| |
|  | Using Listboxes |
| |
|  | The Listbox Widget |
| |
|  | Listbox Bindings and Events |
| |
|  | Listbox Attributes |
 |
| |
|  | Chapter 36.
The Text Widget |
| |
|  | Text Indices |
| |
|  | Text Marks |
| |
|  | Text Tags |
| |
|  | The Selection |
| |
|  | Tag Bindings |
| |
|  | Searching Text |
| |
|  | Embedded Widgets |
| |
|  | Embedded Images |
| |
|  | Looking inside the Text Widget |
| |
|  | The Undo Mechanism |
| |
|  | Text Bindings and Events |
| |
|  | Text Operations |
| |
|  | Text Attributes |
 |
| |
|  | Chapter 37.
The Canvas Widget |
| |
|  | Canvas Coordinates |
| |
|  | Hello, World! |
| |
|  | The Min Max Scale Example |
| |
|  | Canvas Objects |
| |
|  | Canvas Operations |
| |
|  | Generating Postscript |
| |
|  | Canvas Attributes |
| |
|  | Hints |
 |
 |
| |  | Part V.
Tk Details |
| |
|  | Chapter 38.
Selections and the Clipboard> |
| |
|  | The Selection Model |
| |
|  | The selection Command |
| |
|  | The clipboard Command |
| |
|  | Selection Handlers |
 |
| |
|  | Chapter 39.
Focus, Grabs, and Dialogs |
| |
|  | Standard Dialogs |
| |
|  | Custom Dialogs |
| |
|  | Animation with the update Command |
 |
| |
|  | Chapter 40.
Tk Widget Attributes |
| |
|  | Configuring Attributes |
| |
|  | Size |
| |
|  | Borders and Relief |
| |
|  | The Focus Highlight |
| |
|  | Padding and Anchors |
 |
| |
|  | Chapter 41.
Color, Images, and Cursors |
| |
|  | Colors |
| |
|  | Colormaps and Visuals |
| |
|  | Bitmaps and Images |
| |
|  | The Text Insert Cursor |
| |
|  | The Mouse Cursor |
 |
| |
|  | Chapter 42.
Fonts and Text Attributes |
| |
|  | Naming a Font |
| |
|  | X Font Names |
| |
|  | Font Metrics |
| |
|  | The font Command |
| |
|  | Text Attributes |
| |
|  | Gridding, Resizing, and Geometry |
| |
|  | A Font Selection Application |
 |
| |
|  | Chapter 43.
Send |
| |
|  | The send Command |
| |
|  | The Sender Script |
| |
|  | Communicating Processes |
| |
|  | Remote eval through Sockets |
 |
| |
|  | Chapter 44.
Window Managers and Window Information |
| |
|  | The wm Command |
| |
|  | The winfo Command |
| |
|  | The tk Command |
 |
| |
|  | Chapter 45.
Managing User Preferences |
| |
|  | App-Defaults Files |
| |
|  | Defining Preferences |
| |
|  | The Preferences User Interface |
| |
|  | Managing the Preferences File |
| |
|  | Tracing Changes to Preference Variables |
| |
|  | Improving the Package |
 |
| |
|  | Chapter 46.
A User Interface to Bindings |
| |
|  | A Pair of Listboxes Working Together |
| |
|  | The Editing Interface |
| |
|  | Saving and Loading Bindings |
 |
 |
| |  | Part VI.
C Programming |
| |
|  | Chapter 47.
C Programming and Tcl |
| |
|  | Basic Concepts |
| |
|  | Creating a Loadable Package |
| |
|  | A C Command Procedure |
| |
|  | The blob Command Example |
| |
|  | CONST in the Tcl 8.4 APIs |
| |
|  | Strings and Internationalization |
| |
|  | Tcl_Main and Tcl_AppInit |
| |
|  | The Event Loop |
| |
|  | Invoking Scripts from C |
 |
| |
|  | Chapter 48.
Compiling Tcl and Extensions |
| |
|  | Standard Directory Structure |
| |
|  | Building Tcl from Source |
| |
|  | Using Stub Libraries |
| |
|  | Using autoconf |
| |
|  | The Sample Extension |
 |
| |
|  | Chapter 49.
Writing a Tk Widget in C |
| |
|  | Initializing the Extension |
| |
|  | The Widget Data Structure |
| |
|  | The Widget Class Command |
| |
|  | The Widget Instance Command |
| |
|  | Configuring and Reconfiguring Attributes |
| |
|  | Specifying Widget Attributes |
| |
|  | Displaying the Clock |
| |
|  | The Window Event Procedure |
| |
|  | Final Cleanup |
 |
| |
|  | Chapter 50.
C Library Overview |
| |
|  | An Overview of the Tcl C Library |
| |
|  | An Overview of the Tk C Library |
 |
 |
| |  | Part VII.
Changes |
| |
|  | Chapter 51.
Tcl 7.4/Tk 4.0 |
| |
|  | wish |
| |
|  | Obsolete Features |
| |
|  | The cget Operation |
| |
|  | Input Focus Highlight |
| |
|  | Bindings |
| |
|  | Scrollbar Interface |
| |
|  | pack info |
| |
|  | Focus |
| |
|  | The send Command |
| |
|  | Internal Button Padding |
| |
|  | Radiobutton Value |
| |
|  | Entry Widget |
| |
|  | Menus |
| |
|  | Listboxes |
| |
|  | No geometry Attribute |
| |
|  | Text Widget |
| |
|  | Color Attributes |
| |
|  | Color Allocation and tk colormodel |
| |
|  | Canvas scrollincrement |
| |
|  | The Selection |
| |
|  | The bell Command |
 |
| |
|  | Chapter 52.
Tcl 7.5/Tk 4.1 |
| |
|  | Cross-Platform Scripts |
| |
|  | The clock Command |
| |
|  | The load Command |
| |
|  | The package Command |
| |
|  | Multiple foreach loop variables |
| |
|  | Event Loop Moves from Tk to Tcl |
| |
|  | Network Sockets |
| |
|  | Multiple Interpreters and Safe-Tcl |
| |
|  | The grid Geometry Manager |
| |
|  | The Text Widget |
| |
|  | The Entry Widget |
 |
| |
|  | Chapter 53.
Tcl 7.6/Tk 4.2 |
| |
|  | More file Operations |
| |
|  | Virtual Events |
| |
|  | Standard Dialogs |
| |
|  | New grid Geometry Manager |
| |
|  | Macintosh unsupported1 Command |
 |
| |
|  | Chapter 54.
Tcl/Tk 8.0 |
| |
|  | The Tcl Compiler |
| |
|  | Namespaces |
| |
|  | Safe-Tcl |
| |
|  | New lsort |
| |
|  | tcl_precision Variable |
| |
|  | Year 2000 Convention |
| |
|  | Http Package |
| |
|  | Serial Line I/O |
| |
|  | Platform-Independent Fonts |
| |
|  | The tk scaling Command |
| |
|  | Application Embedding |
| |
|  | Native Menus and Menubars |
| |
|  | CDE Border Width |
| |
|  | Native Buttons and Scrollbars |
| |
|  | Images in Text Widgets |
| |
|  | No Errors from destroy |
| |
|  | grid rowconfigure |
| |
|  | The Patch Releases |
 |
| |
|  | Chapter 55.
Tcl/Tk 8.1 |
| |
|  | Unicode and Internationalization |
| |
|  | Thread Safety |
| |
|  | Advanced Regular Expressions |
| |
|  | New String Commands |
| |
|  | The DDE Extension |
| |
|  | Miscellaneous |
 |
| |
|  | Chapter 56.
Tcl/Tk 8.2 |
| |
|  | The Trf Patch |
| |
|  | Faster String Operations |
| |
|  | Empty Array Names |
| |
|  | Browser Plugin Compatibility |
| |
|  | Finer Control of Windows Serial Port Monitoring |
| |
|  | Regular Expression Expanded Syntax Option |
 |
| |
|  | Chapter 57.
Tcl/Tk 8.3 |
| |
|  | New File Manipulation Commands and Options |
| |
|  | New glob Options |
| |
|  | Regular Expression Command Enhancements |
| |
|  | Direct Return of scan Matches |
| |
|  | Removing Duplicate List Elements with lsort |
| |
|  | Deleting Elements from an Array |
| |
|  | Enhanced clock Features |
| |
|  | Support for Delayed Package Loading in pkg_mkIndex |
| |
|  | The Img Patch |
| |
|  | The Dash Patch |
| |
|  | Other New Tk Features |
| |
|  | The Patch Releases |
 |
| |
|  | Chapter 58.
Tcl/Tk 8.4 |
| |
|  | 64-Bit Support |
| |
|  | Additional Filesystem Features and Commands |
| |
|  | New and Enhanced List Commands |
| |
|  | Array Searching and Statistics |
| |
|  | Enhanced Support for Serial Communications |
| |
|  | New String Comparison Operators |
| |
|  | Command Tracing |
| |
|  | Additional Introspection Commands |
| |
|  | Other Tcl Changes |
| |
|  | New Tk Widgets |
| |
|  | Text Widget Undo Mechanism and Other Enhancements |
| |
|  | New pack and grid Features |
| |
|  | Displaying Both Text and an Image in a Widget |
| |
|  | New Button Relief Attributes |
| |
|  | Controlling the State of Entries and Listboxes |
| |
|  | More Window Manager Interaction |
| |
|  | Other Tk Changes |
 |
| |
|  | Chapter 59.
About The CD-ROM |
| |
|  | Technical Support |
 |
 |
| |  | Index |