Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

itclvars(n) [redhat man page]

itclvars(n)							    [incr Tcl]							       itclvars(n)

NAME
itclvars - variables used by [incr Tcl] DESCRIPTION
The following global variables are created and managed automatically by the [incr Tcl] library. Except where noted below, these variables should normally be treated as read-only by application-specific code and by users. itcl::library When an interpreter is created, [incr Tcl] initializes this variable to hold the name of a directory containing the system library of [incr Tcl] scripts. The initial value of itcl::library is set from the ITCL_LIBRARY environment variable if it exists, or from a compiled-in value otherwise. itcl::patchLevel When an interpreter is created, [incr Tcl] initializes this variable to hold the current patch level for [incr Tcl]. For example, the value "2.0p1" indicates [incr Tcl] version 2.0 with the first set of patches applied. itcl::purist When an interpreter is created containing Tcl/Tk and the [incr Tcl] namespace facility, this variable controls a "backward-compati- bility" mode for widget access. In vanilla Tcl/Tk, there is a single pool of commands, so the access command for a widget is the same as the window name. When a widget is created within a namespace, however, its access command is installed in that namespace, and should be accessed outside of the namespace using a qualified name. For example, namespace foo { namespace bar { button .b -text "Testing" } } foo::bar::.b configure -background red pack .b Note that the window name ".b" is still used in conjunction with commands like pack and destroy. However, the access command for the widget (i.e., name that appears as the first argument on a command line) must be more specific. The "winfo command" command can be used to query the fully-qualified access command for any widget, so one can write: [winfo command .b] configure -background red and this is good practice when writing library procedures. Also, in conjunction with the bind com- mand, the "%q" field can be used in place of "%W" as the access command: bind Button <Key-Return> {%q flash; %q invoke} While this behavior makes sense from the standpoint of encapsulation, it causes problems with existing Tcl/Tk applications. Many existing applications are written with bindings that use "%W". Many library procedures assume that the window name is the access command. The itcl::purist variable controls a backward-compatibility mode. By default, this variable is "0", and the window name can be used as an access command in any context. Whenever the unknown procedure stumbles across a widget name, it simply uses "winfo command" to determine the appropriate command name. If this variable is set to "1", this backward-compatibility mode is disabled. This gives better encapsulation, but using the window name as the access command may lead to "invalid command" errors. itcl::version When an interpreter is created, [incr Tcl] initializes this variable to hold the version number of the form x.y. Changes to x rep- resent major changes with probable incompatibilities and changes to y represent small enhancements and bug fixes that retain back- ward compatibility. KEYWORDS
itcl, variables itcl 3.0 itclvars(n)

Check Out this Related Man Page

scope(n)							    [incr Tcl]								  scope(n)

__________________________________________________________________________________________________________________________________________________

NAME
scope - capture the namespace context for a variable SYNOPSIS
itcl::scope name _________________________________________________________________ DESCRIPTION
Creates a scoped value for the specified name, which must be a variable name. If the name is an instance variable, then the scope command returns a string of the following form: @itcl object varName This is recognized in any context as an instance variable belonging to object. So with itcl3.0 and beyond, it is possible to use instance variables in conjunction with widgets. For example, if you have an object with a private variable x, and you can use x in conjunction with the -textvariable option of an entry widget. Before itcl3.0, only common variables could be used in this manner. If the name is not an instance variable, then it must be a common variable or a global variable. In that case, the scope command returns the fully qualified name of the variable, e.g., ::foo::bar::x. If the name is not recognized as a variable, the scope command returns an error. Ordinary variable names refer to variables in the global namespace. A scoped value captures a variable name together with its namespace context in a way that allows it to be referenced properly later. It is needed, for example, to wrap up variable names when a Tk widget is used within a namespace: namespace foo { private variable mode 1 radiobutton .rb1 -text "Mode #1" -variable [scope mode] -value 1 pack .rb1 radiobutton .rb2 -text "Mode #2" -variable [scope mode] -value 2 pack .rb2 } Radiobuttons .rb1 and .rb2 interact via the variable "mode" contained in the namespace "foo". The scope command guarantees this by return- ing the fully qualified variable name ::foo::mode. You should never use the @itcl syntax directly. For example, it is a bad idea to write code like this: set {@itcl ::fred x} 3 puts "value = ${@itcl ::fred x}" Instead, you should always use the scope command to generate the variable name dynamically. Then, you can pass that name to a widget or to any other bit of code in your program. KEYWORDS
code, namespace, variable itcl scope(n)
Man Page