Debian Codegraph @

pod/pTk/Name.pod

raw
1 # Copyright (c) 1990 The Regents of the University of California.
2 # Copyright (c) 1994-1997 Sun Microsystems, Inc.
3 # See the file "license.terms" for information on usage and redistribution
4 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
5 #
6 #
7
8 =head1 NAME
9
10 Tk_Name, Tk_PathName, Tk_NameToWindow - convert between names and window tokens
11
12 =for category C Programming
13
14 =head1 SYNOPSIS
15
16 B<#include E<lt>tk.hE<gt>>
17
18 Tk_Uid
19 B<Tk_Name>(I<tkwin>)
20
21 char *
22 B<Tk_PathName>(I<tkwin>)
23
24 Tk_Window
25 B<Tk_NameToWindow>(I<interp, pathName, tkwin>)
26
27 =head1 ARGUMENTS
28
29 =over 4
30
31 =item Tk_Window tkwin (in)
32
33 Token for window.
34
35 =item Tcl_Interp *interp (out)
36
37 Interpreter to use for error reporting.
38
39 =item char *pathName (in)
40
41 Character string containing path name of window.
42
43 =back
44
45 =head1 DESCRIPTION
46
47 Each window managed by Tk has two names, a short name that identifies
48 a window among children of the same parent, and a path name that
49 identifies the window uniquely among all the windows belonging to the
50 same main window. The path name is used more often in Tk than the
51 short name; many commands, like B<bind>, expect path names as
52 arguments.
53
54 The B<Tk_Name> macro returns a window's
55 short name, which is the same as the I<name> argument
56 passed to B<Tk_CreateWindow> when
57 the window was created. The value is returned
58 as a Tk_Uid, which may be used just like a string pointer but also has
59 the properties of a unique identifier (see the the documentation for
60 B<Tk_GetUid> for details).
61
62 The B<Tk_PathName> macro returns a
63 hierarchical name for I<tkwin>.
64 Path names have a structure similar to file names in Unix but with
65 dots between elements instead of slashes: the main window for
66 an application has the path name ``.''; its children have names like
67 ``.a'' and ``.b''; their children have names like ``.a.aa'' and
68 ``.b.bb''; and so on. A window is considered to be be a child of
69 another window for naming purposes if the second window was named
70 as the first window's I<parent> when the first window was created.
71 This is not always the same as the X window hierarchy. For
72 example, a pop-up
73 is created as a child of the root window, but its logical parent will
74 usually be a window within the application.
75
76 The procedure B<Tk_NameToWindow> returns the token for a window
77 given its path name (the $widget argument) and another window
78 belonging to the same main window (I<tkwin>). It normally
79 returns a token for the named window, but if no such window exists
80 B<Tk_NameToWindow> leaves an error message in I<interp-E<gt>result>
81 and returns NULL. The I<tkwin> argument to B<Tk_NameToWindow>
82 is needed because path names are only unique within a single
83 application hierarchy. If, for example, a single process has opened
84 two main windows, each will have a separate naming hierarchy and the
85 same path name might appear in each of the hierarchies. Normally
86 I<tkwin> is the main window of the desired hierarchy, but this
87 need not be the case: any window in the desired hierarchy may be used.
88
89 =head1 KEYWORDS
90
91 name, path name, token, window