#

## tk_path_name

Execute a window command in the indicated window.

### Shortcuts:

> Key macro : (colon) implements the command tk_path_name by prepending the window name to the command typed on the command line when the command is executed. This action is, however, transparent to the end user.

### Usage:

> tk_path_name command_name

> > where command_name is any valid window command for the type of window indicated by tk_path_name.

### Summary:

> The tk_path_name command is unique for each window that is created in magic. The name of the window is registered as a command name with the Tcl interpreter. When the window name is used as a command, the arguments of the command are passed to the magic command interpreter to be executed in the context of that specific window. Effectively, it is the same as typing the macro ":" (colon) in a layout window, and then typing the command on the command line.

> For example, the default first window that is created in the Tcl GUI version of magic is .layout1.magic. Upon creation, the command name .layout1.magic is registered with the Tcl interpreter. Subsequently, any command on the command-line will be executed in relation to that window if it is specified as an option to the .layout1.magic command:

> > .layout1.magic box 0 0 10 10

> which is exactly the same as putting the X11 pointer cursor in the layout window, typing the ":" (colon) macro, then typing the command box 0 0 10 10 into the command line and hitting the return key.

> Similarly to layout windows, windows created with the specialopen command have their Tk path names registered as commands with the Tcl interpreter, and can be passed commands recognized by the specific window type (e.g., netlist commands in the netlist special window).

> The tk_path_name commands effectively implement the command "send" as it is used in the non-Tcl-based versions of Magic. For example, the command "send netlist shownet" can be written, in Tcl-based Magic, as the following:

> > [windownames netlist] shownet

> Note here the nested command "windownames netlist" that returns the Tk path name of the netlist window, which is then evaluated as a command.

### See Also:

> windownames

### Implementation Notes:

> tk_path_name is implemented as a built-in command in magic which is registered with the Tcl interpreter when the window is created and unregistered when the window is destroyed.

Return to command index

Last updated: March 7, 2020 at 1:06pm