| Tcl Dev Kit User Guide | |
Inspector
The Tcl Dev Kit Inspector analyzes a running Tcl or Tk
application and provides an interface for viewing the program's components.
It is based on Tkinspect, a Tk program browser originally written by Sam
Shen at LBL. When you attach to a running application via a comm port, or
via Tk's send command, components within the application are organized
and displayed according to the component type.
The Value Window displays the configuration of
a component; click a specific component in a list
to display its value. The configuration of a component can be changed in the
Value window, and the change sent to the running application
by clicking the Send button.
Tcl commands can be sent to the attached application using the
Command field.
Invoke the Inspector by selecting
Tcl Dev Kit Inspector from the Tcl Dev Kit program group on the
Windows Start menu.
Alternatively, you can launch the Inspector from the command
line. On Windows systems, enter tclinspector.exe at the command
prompt. On Unix systems, enter tclinspector at the shell prompt.
To invoke a new Inspector session, or to close an existing
session, use the options on the File menu. If the
Inspector session was invoked from another
Inspector session (via the File | New Window
option), the Close Window
option will only close the spawned window. The Exit option
will close all Inspector sessions.
Attaching to an Application via a Comm Port
The Inspector can interface with Tcl and Tk applications
loaded via tkcon or via a Tcl or Wish shell. For example, to
load an application via tkcon, load the desired application in
tkcon, then enter the following commands:
source application_name
package require comm
comm::comm self
The last command will return the port number on which the program is
running.
From the File menu in the Inspector,
select Connect to comm port, and enter the port number
reported by tkcon.
The Inspector can be connected to multiple ports at
once. To display the ports to which the Inspector is connected,
or to select an alternative port for display, select File | Attach to
Interp (comm). Connections will be displayed by the port number and the
method by which the application is loaded. For example, if tkcon
reported that the application was running on port 2824, the
Attach to Interp (comm) menu option would display an entry
reading "2824 (tkcon.tcl)".
In addition to any manual connections, the Inspector is
always connected to itself; the Inspector connection is
described as "self" in the Attach to Interp (comm) menu.
Attaching to an Application via "send"
Attaching via send (File | Attach to Interp
(send) makes use of the Unix X-based mechanism.
It is supported by the Inspector, but because of inherent
security issues (described in the send manpage), the
comm method described above is the preferred connection method.
Top
The Inspector interface consists of the following
components:

To disable (or re-enable) the pop-up tooltips that describe components
of the interface, select Help | Show Tooltips.
To change the font size displayed in the Inspector, press
Ctrl-plus to increase the font size or Ctrl-minus to
decrease the displayed font size. If using Windows with a mouse wheel, you can
alternatively press the Ctrl key and then rotate the mouse wheel to
increase or decrease the font size displayed in the Inspector.
Top
"Lists" are program components grouped by component type. They are
displayed in columns beneath the menu bar. By default, the
Namespaces, Procs and Globals
lists are displayed when the Inspector is invoked. Use the View
menu to enable or disable the display of individual lists.
Items are analyzed recursively. Items in packages referenced in the original
application will be included.
The following list types are available:
- Namespaces: Items in the application
declared using the
namespace command.
- Procs: Items in the application
declared using the
procs command.
- Globals: Items in the application
declared using the
global command.
- Classes: [incr Tcl] classes contained
in the application.
- Objects: [incr Tcl] objects contained
in the application.
- Windows: Items in the application
that generate a GUI component, such as menus, buttons, etc.
- Images: Items in the application
declared using the
image command.
- Menus: Items in the application
declared using the
menu command.
- Canvases: Items in the
application declared using the
canvas command.
- Afters: Items in the application
declared using the
after command.
When a list is selected for display, an entry will be added to the
Windows menu that contains options for the list. The menu
contains a set of standard operations, followed by list-specific operations
(if any are available). The operations menu can also be accessed by
right-clicking within the list. Standard list operations include:
- Show a item...: This option displays a dialog
used for selecting a specific item in the list. The dialog contains a listbox
where all items of the specified type are listed. After selecting an item,
details about the item are displayed in the
Value Window.
- Edit Filter...: This option displays a dialog that is
used to configure a filter for the list contents. Multiple patterns can be
defined; the filter can be configured to either include or exclude items
that match the specified patterns. The default configuration varies for
each list type.
- Find items...:
This option displays a dialog
that is used to search the list for one or more items matching the specified
search criteria. The search can be configured to find exact matches, to
perform glob-style matching (using the asterisk (*) to match any sequence
of characters and a question mark (?) to match any single character), or to
perform regular expression pattern matching.
- Refresh:
This option regenerates the list
display. To regenerate the display of all lists, use the
View | Refresh All drop-down menu option.
- Remove:
This option removes the list from the Inspector
display. Lists can also be removed by clicking (and thus de-selecting) the
list name in the View drop-down menu.
Operations that are specific to the list type are described in the
pertinent sections below. For example, the Globals list has
an additional option called "Trace Variable" that is described in the
Globals section below.
Top
The Namespaces List contains a list of the namespaces
defined in the application via the namespace command. This list
has no list-specific operations. There is no default filter on the list.
Top
The Procs List contains a list of procedures defined in
the application via the proc command. This list has no
list-specific operations. The default filter on the list is configured to
exclude the following patterns:
^auto_.*
^tk[A-Z].*
Top
The Globals List contains a list of the global variables
defined in the application via the global command. This list
has one list-specific operation: Trace Variable
creates a new toplevel window that will display "set" statements
that write to the variable. (The trace window will display the last 50
"set" statements.) Trace Variable handles both
scalars and arrays.
For an interesting example of how this works, try the following:
- From the Attach | Interpreter (comm) menu, select
the Inspector application (which will be identified as "self").
- In the Globals List, select
tk::Priv.
- From the Globals menu, select
Trace Variable.
A trace window will be displayed that tracks the tk::Priv array.
The default filter on the list is configured to exclude the following
patterns:
^auto_.*
^tkPriv.*
^tk_.*
Top
The Classes List contains a list of the
[incr Tcl] classes defined in the application. The
Inspector uses the [incr Tcl]
info command to reconstruct the class definition, showing
the member variable definitions and the class method code. This list
has no list-specific operations. There is no default filter on the list.
Top
The Objects List contains a list of the
[incr Tcl] objects defined in the application. The
Inspector uses the [incr Tcl]
info command to reconstruct the class definition, showing
the member variable definitions and the class method code. This list
has no list-specific operations. There is no default filter on the list.
Top
The Windows List contains a list of the items in the
application that generate a GUI component, such as menus, buttons, etc.
There is no default filter on the list.
The Windows List is the Inspector's
most complicated list. In addition to the
standard list operations, the
Windows menu contains a group of options that determine
the type of information that is displayed in the Value
window. The options are exclusive; that is, only one option can be selected
at a time. The options include:
- Window Configuration: Displays the configuration of
the window.
- Window Geometry: Displays the
pack and / or
grid settings for the window.
- Slave Window Geometry:Displays the
pack
and / or grid settings for slaves of the window.
- Window Bindtags & Bindings: Displays the current
bindtag order, along with the bindings of each of the tags.
- Window Bindtags: Displays the current bindtag order of
the window.
- Window Bindings: Displays the bindings for the
window.
- Window Class Bindings: Displays the bindings for the
window's class.
The following options avoid common pitfalls in sending back window
values. All of these options can be enabled at the same time.
- Filter Setting of Empty Window Options: Removes the
display of options that would be empty when sent. Enabled by default.
- Filter Setting of Window -class Options: Removes
-class options from values that are displayed. Setting the
window class of frame and toplevel after they've
been created is an error. Enabled by default.
- Filter Setting of Pack -in Options: Removes
-in options from values that are displayed. Enabled by
default.
The following option controls how windows are retrieved:
- Get Window Information: If this option is enabled (the
default), window information is retrieved when an interpreter is selected
via the Attach menu, or when the Window list is
refreshed. If this option is not enabled, window information is not
retrieved. Disable this option if the list of windows takes a long time
to retrieve.
The default filter on the list is configured to exclude the pattern
^\.#.*.
Top
The Images List contains a list of the images defined in
the application via Tk's image command. The list has one
list-specific operation: Display Image sends a command to the
application to create a new toplevel window containing the selected image.
There is no default filter on the list.
Top
The Menus List contains a list of the menus defined in
the application via Tk's menu command. This list has no
list-specific operations. There is no default filter on the list.
Top
The Canvases List contains a list of the canvases defined
in the application via Tk's canvas command. This list has no
list-specific operations. There is no default filter on the list.
Top
The Afters List contains a list of the items defined in
the application via the after command. This list has no
list-specific operations. There is no default filter on the list.
Top
The Value Window is an editable Tk text window that
displays details of the most-recently selected item from a list. Configuration
items can be changed and sent back to the application by clicking the
Send button.
The most recent 15 items that were selected from the lists can be displayed
by clicking in the area above the Value window. Select an item
from the list to re-display the value.
The Value menu item in the main menu bar contains a number
of options. These options can also be displayed by right-clicking in the
Value window:
- Send Value: Sends the contents of the
Value window back to the application.
- Find...: Displays a dialog box used for searching
the contents of the Value window.
- Save Value...: Displays a dialog box used for saving
the contents of the Value window to a file.
- Load Value...: Displays a dialog box used for selecting
a file that contains content you want inserted in the Value
window. The current contents of the window will be replaced by the contents
of the file.
- Detach Window: Creates a new Inspector
window that contains the contents of the Value window
from the original Inspector session.
The following shortcut key strokes are supported:
- Control+x Control+s: Sends the value back to the
selected interpreter.
- Control+s: Displays the Find...
dialog.
Top
|