1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1990 The Regents of the University of California.
|
3 |
|
|
'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.
|
4 |
|
|
'\"
|
5 |
|
|
'\" See the file "license.terms" for information on usage and redistribution
|
6 |
|
|
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
7 |
|
|
'\"
|
8 |
|
|
'\" RCS: @(#) $Id: Name.3,v 1.1.1.1 2002-01-16 10:25:48 markom Exp $
|
9 |
|
|
'\"
|
10 |
|
|
.so man.macros
|
11 |
|
|
.TH Tk_Name 3 "" Tk "Tk Library Procedures"
|
12 |
|
|
.BS
|
13 |
|
|
.SH NAME
|
14 |
|
|
Tk_Name, Tk_PathName, Tk_NameToWindow \- convert between names and window tokens
|
15 |
|
|
.SH SYNOPSIS
|
16 |
|
|
.nf
|
17 |
|
|
\fB#include \fR
|
18 |
|
|
.sp
|
19 |
|
|
Tk_Uid
|
20 |
|
|
\fBTk_Name\fR(\fItkwin\fR)
|
21 |
|
|
.sp
|
22 |
|
|
char *
|
23 |
|
|
\fBTk_PathName\fR(\fItkwin\fR)
|
24 |
|
|
.sp
|
25 |
|
|
Tk_Window
|
26 |
|
|
\fBTk_NameToWindow\fR(\fIinterp, pathName, tkwin\fR)
|
27 |
|
|
.SH ARGUMENTS
|
28 |
|
|
.AS Tcl_Interp *pathName
|
29 |
|
|
.AP Tk_Window tkwin in
|
30 |
|
|
Token for window.
|
31 |
|
|
.AP Tcl_Interp *interp out
|
32 |
|
|
Interpreter to use for error reporting.
|
33 |
|
|
.AP char *pathName in
|
34 |
|
|
Character string containing path name of window.
|
35 |
|
|
.BE
|
36 |
|
|
|
37 |
|
|
.SH DESCRIPTION
|
38 |
|
|
.PP
|
39 |
|
|
Each window managed by Tk has two names, a short name that identifies
|
40 |
|
|
a window among children of the same parent, and a path name that
|
41 |
|
|
identifies the window uniquely among all the windows belonging to the
|
42 |
|
|
same main window. The path name is used more often in Tk than the
|
43 |
|
|
short name; many commands, like \fBbind\fR, expect path names as
|
44 |
|
|
arguments.
|
45 |
|
|
.PP
|
46 |
|
|
The \fBTk_Name\fR macro returns a window's
|
47 |
|
|
short name, which is the same as the \fIname\fR argument
|
48 |
|
|
passed to \fBTk_CreateWindow\fR when
|
49 |
|
|
the window was created. The value is returned
|
50 |
|
|
as a Tk_Uid, which may be used just like a string pointer but also has
|
51 |
|
|
the properties of a unique identifier (see the manual entry for
|
52 |
|
|
\fBTk_GetUid\fR for details).
|
53 |
|
|
.PP
|
54 |
|
|
The \fBTk_PathName\fR macro returns a
|
55 |
|
|
hierarchical name for \fItkwin\fR.
|
56 |
|
|
Path names have a structure similar to file names in Unix but with
|
57 |
|
|
dots between elements instead of slashes: the main window for
|
58 |
|
|
an application has the path name ``.''; its children have names like
|
59 |
|
|
``.a'' and ``.b''; their children have names like ``.a.aa'' and
|
60 |
|
|
``.b.bb''; and so on. A window is considered to be be a child of
|
61 |
|
|
another window for naming purposes if the second window was named
|
62 |
|
|
as the first window's \fIparent\fR when the first window was created.
|
63 |
|
|
This is not always the same as the X window hierarchy. For
|
64 |
|
|
example, a pop-up
|
65 |
|
|
is created as a child of the root window, but its logical parent will
|
66 |
|
|
usually be a window within the application.
|
67 |
|
|
.PP
|
68 |
|
|
The procedure \fBTk_NameToWindow\fR returns the token for a window
|
69 |
|
|
given its path name (the \fIpathName\fR argument) and another window
|
70 |
|
|
belonging to the same main window (\fItkwin\fR). It normally
|
71 |
|
|
returns a token for the named window, but if no such window exists
|
72 |
|
|
\fBTk_NameToWindow\fR leaves an error message in \fIinterp->result\fR
|
73 |
|
|
and returns NULL. The \fItkwin\fR argument to \fBTk_NameToWindow\fR
|
74 |
|
|
is needed because path names are only unique within a single
|
75 |
|
|
application hierarchy. If, for example, a single process has opened
|
76 |
|
|
two main windows, each will have a separate naming hierarchy and the
|
77 |
|
|
same path name might appear in each of the hierarchies. Normally
|
78 |
|
|
\fItkwin\fR is the main window of the desired hierarchy, but this
|
79 |
|
|
need not be the case: any window in the desired hierarchy may be used.
|
80 |
|
|
|
81 |
|
|
.SH KEYWORDS
|
82 |
|
|
name, path name, token, window
|