Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
Look up keyword or section
Like this

Table Of Contents

Tcl Fundamentals 1
Getting Started
Tcl Commands
Hello World
Command Substitution
Math Expressions
Backslash Substitution
Double Quotes
A While Loop Example
Grouping And Command Substitution
More About Variable Substitution
Substitution And Grouping Summary
Fine Points
Command Line Arguments
Backslash Sequences
Arithmetic Operators
Table 1–2Arithmetic Operators from highest to lowest precedence
Built-in Math Functions
Core Tcl Commands
Strings and Pattern Matching2
The string Command
Strings And Expresssions
The append Command
The format Command
The scan Command
String Matching
Regular Expressions
The regexp Command
Example 2–2Regular expression to parse theDISPLAY environment variable
The regsub Command
Tcl Data Structures 3
More About Variables
The unset command
Using info to find out about variables
Example 3–2Usinginfo to determine if a variable exists
Tcl Lists
Constructing Lists: list, lappend, and concat
Getting List Elements: llength, lindex, and lrange
Modifying Lists: linsert and lreplace
Searching Lists: lsearch
Sorting Lists: lsort
The split And join Commands
The array Command
Environment Variables
Tracing Variable Values
Control Flow Commands 4
If Then Else
Example 4–5Usingswitch with all pattern body pairs grouped with quotes
Break And Continue
Procedures and Scope 5
The proc Command
Changing command names with rename
The global Command
Use Arrays for Global State
Call By Name Using upvar
Passing arrays by name
The uplevel Command
Eval And List
Eval And Concat
Double-quotes and eval
Commands That Concat Their Arguments
The subst Command
Working with UNIX 7
Running Unix Programs With exec
Table 7–1Summary of theexec syntax for I/O redirection
Looking At The File System
Opening Files For I/O
Reading And Writing
The puts and gets commands
The read command
Random access I/O
Closing I/O streams
The Current Directory - cd And pwd
Matching File Names With glob
The exit And pid commands
The info Command
The call stack
Command evaluation
Scripts and the library
Version numbers
Interactive Command History
History syntax
A comparision to /bin/csh history syntax
Don Libes’ debugger
Breakpoints by pattern matching
Deleting break points
The tkerror Command
The tkinspect Program
Performance Tuning
Script Libraries 9
The unknown Command
The tclIndex File
Using A Library: auto_path
Disabling the library facility: auto_noload
How Auto Loading Works
Interactive Conveniences
Auto Execute
Tcl Shell Library Environment
Coding Style
A module prefix for procedure names
A global array for state variables
Tk Fundamentals 10
Hello World In Tk
Naming Tk Widgets
About The Tk Man Pages
Summary Of The Tk Commands
Tk by Example 11
Window title
A frame for buttons, etc
Command buttons
A label and an entry
Key bindings and focus
A resizable text and scrollbar
The Run proc
The Log procedure
The Stop procedure
The Example Browser
Example 11–2A browser for the code examples in the book
More about resizing windows
Managing global state
Cascaded menus
The Browse proc
A Tcl Shell
Naming issues
Text marks and bindings
The Pack Geometry Manager12
Packing towards a side
Shrinking frames and pack propagate
Horizontal And Vertical Stacking
Example 12–4Even more nesting of horizontal and vertical stacks
The Cavity Model
Packing Space and Display Space
Choosing The Parent For Packing
Unpacking a Widget
Packer Summary
The pack Command
The Place Geometry Manager
The place Command
Window Stacking Order
Binding Commands to X Events13
The bind Command
All, Class, And Widget Bindings
The bindtags command
break and continue in bindings
A note about bindings in earlier versions of Tk
Event Syntax
Table 13–1Event types. Comma-separated types are equivalent
Key Events
Button Events
Other Events
Events in Tk 3.6 and earlier
Event Sequences
Event Keywords
Buttons and Menus 14
Button Commands and Scope Issues
Buttons Associated with Tcl Variables
Button Attributes
Button Operations
Menus and Menubuttons
Manipulating Menus and Menu Entries
A Menu by Name Package
Popup Menus and Option Menus
Keyboard Traversal
Menu Attributes
Simple Tk Widgets 15
Frames and Top-Level Windows
Attributes for frames and toplevels
The label Widget
Label attributes
Label width and wrapLength
The message Widget
Message Attributes
Arranging Labels and Messages
The scale Widget
Scale attributes
Programming scales
The scrollbar Widget
Scrollbar attributes
Table 15–8Resource names of attributes forscrollbar widgets
Programming scrollbars
The Tk 3.6 protocol
The bell Command
Entry and Listbox Widgets 16
The entry Widget
entry attributes
Programming entry widgets
The listbox Widget
Programming listboxes
Listbox Bindings
Browse select mode
Single select mode
Table 16–9Bindings for alistbox insingle selectMode
Extended select mode
Multiple select mode
Scroll bindings
listbox attributes
Geometry gridding
Focus, Grabs, and Dialogs 17
Input Focus
The focus command
Focus follows mouse
Click to type
Hybrid models
Grabbing the Focus
The tkwait Command
Prompter dialog
Destroying widgets
Focusing on buttons
Animation with the update command
File Selection Dialog
Creating the dialog
Listing the directory
Accepting a name
Easy stuff
File name completion
The text Widget 18
Text widget taxonomy
Text Indices
Text Marks
Text Tags
Tag attributes
Mixing attributes from different tags
Line Spacing and Justification
The Selection
Tag Bindings
Embedded Widgets
Text Bindings
Text Operations
Text Attributes
The canvas Widget 19
Hello, World!
The Double-Slider Example
Canvas Coordinates
Bitmap Items
Line Items
Oval Items
Polygon Items
Rectangle Items
Text Items
Example 19–12Simple edit bindings for canvas text items
Window Items
Canvas Operations
Generating Postscript
Canvas Attributes
Large coordinate spaces
Scaling and Rotation
X Resources
Objects with many points
The send Command
The sender script
Using sender
Hooking the browser to a shell
Tk Widget Attributes 22
Borders and Relief
The Focus Highlight
Padding and Anchors
Putting It All Together
Color, Images, and Cursors 23
Colormaps and Visuals
Table 23–2Visual classes for X displays. Values for the visual attribute
Bitmaps and Images
The image Command
bimap images
The bitmap attribute
photo images
The Mouse Cursor
The Text Insert Cursor
Fonts and Text Attributes 24
Text Layout
Gridding, Resizing, and Geometry
Selection Attributes
A Font Selection Application
Window Managers and Window Information 25
The wm Command
Size, placement, and decoration
Session state
The winfo Command
Sending commands between applications
Family relationships
Virtual root window
Atoms and IDs
Table 25–9Information associated with virtual root windows
Colormaps and visuals
The tk Command
A User Interface to bind 26
A Binding User Interface
Example 26–2Bind_Display presents the bindings for a given widget or class
A Pair of Listboxes Working Together
Example 26–4Controlling a pair of listboxes with one scrollbar
The Editing Interface
Using X Resources 27
An Introduction To X Resources
Warning: order is important!
Loading Option Database Files
Adding Individual Database Entries
Accessing The Database
Managing User Preferences28
App-Defaults Files
Defining Preferences
The Preferences User Interface
Managing The Preferences File
Tracing Changes To Preference Variables
C Programming and Tcl 29
Using the Tcl C Library
Application Structure
Tcl_Main and Tcl_AppInit
The standard main in Tcl 7.3
A C Command Procedure
Managing The Result’s Storage
Invoking Scripts From C
Bypassing Tcl_Eval
Putting A Tcl Program Together
An Overview of the Tcl C library
Application initialization
Creating and deleting interpreters
Creating and deleteing commands
Managing the result string
Lists and command parsing
Command pipelines
Tracing the actions of the Tcl interpreter
Evalutating Tcl commands
Manipulating Tcl variables
Evalutating expressions
Converting numbers
Hash tables
Dynamic Strings
Regular expressions and string matching
Tilde Substitution
Working with signals
C Programming and Tk 30
Tk_Main and Tcl_AppInit
A Custom Main Program
A Custom Event Loop
An Overview of the Tk C library
Parsing command line arguments
The standard application setup
Creating windows
Application name for send
Window coordinates
Window stacking order
Window information
Configuring widget attributes
Safe handling of the widget data structure
The selection and clipboard
Event bindings
Event loop interface
Handling X events
File handlers
Timer events
Idle callbacks
Reporting script errors
Handling X protocol errors
Using the X resource database
Managing bitmaps
Creating new image types
Using an image in a widget
Photo image types
Canvas object support
Geometry managment
String identifiers (UIDS)
Colors and Colormaps
Widget Instance Command
Example 31–5ClockConfigure allocates resources for the widget
Displaying The Clock
The Window Event Procedure
Final Cleanup
Tcl Extension Packages 32
Extended Tcl
Adding tclX to your application
More UNIX system calls
File operations
New loop constructs
Command line addons
Debugging and development support
TCP/IP access
File scanning (i.e., awk)
Math functions as commands
List operations
Keyed list data structure
String utilities
XPG/3 message catalog
Memory debugging
Expect: Controlling Interactive Programs
The core expect commandsl
Pattern matching
Important variables
An example expect script
Debugging expect scripts
Expect’s Tcl debugger
The Dbg C interface
Tcl_AppInit With Extensions
Other Extensions
Porting to Tk 4.0 33
Obsolete Features
Scrollbar Interface
Pack info
Radio Buttons
Entry Widget
Text Widget
Color Attributes
0 of .
Results for:
No results containing your search query
P. 1


|Views: 7|Likes:
Published by engineeringhigh

More info:

Published by: engineeringhigh on Jul 20, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





You're Reading a Free Preview
Pages 10 to 153 are not shown in this preview.
You're Reading a Free Preview
Pages 163 to 286 are not shown in this preview.
You're Reading a Free Preview
Pages 296 to 401 are not shown in this preview.
You're Reading a Free Preview
Pages 411 to 430 are not shown in this preview.
You're Reading a Free Preview
Pages 440 to 455 are not shown in this preview.

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->