<HTML><HEAD><TITLE>Library Procedures - Tk_Name manual page</TITLE></HEAD><BODY> <H3><A NAME="M2">NAME</A></H3> Tk_Name, Tk_PathName, Tk_NameToWindow - convert between names and window tokens <H3><A NAME="M3">SYNOPSIS</A></H3> <B>#include <tk.h></B><BR> <A HREF="../TkLib/GetUid.htm">Tk_Uid</A><BR> <B>Tk_Name</B>(<I>tkwin</I>)<BR> char *<BR> <B>Tk_PathName</B>(<I>tkwin</I>)<BR> Tk_Window<BR> <B>Tk_NameToWindow</B>(<I>interp, pathName, tkwin</I>)<BR> <H3><A NAME="M4">ARGUMENTS</A></H3> <DL> <P><DT>Tk_Window <B>tkwin</B> (in)<DD> Token for window. <P><DT><A HREF="../TclLib/Interp.htm">Tcl_Interp</A> <B>*interp</B> (out)<DD> Interpreter to use for error reporting. <P><DT>char <B>*pathName</B> (in)<DD> Character string containing path name of window. <P></DL> <H3><A NAME="M5">DESCRIPTION</A></H3> Each window managed by Tk has two names, a short name that identifies a window among children of the same parent, and a path name that identifies the window uniquely among all the windows belonging to the same main window. The path name is used more often in Tk than the short name; many commands, like <B><A HREF="../TkCmd/bind.htm">bind</A></B>, expect path names as arguments. <P> The <B>Tk_Name</B> macro returns a window's short name, which is the same as the <I>name</I> argument passed to <B><A HREF="../TkLib/CrtWindow.htm">Tk_CreateWindow</A></B> when the window was created. The value is returned as a <A HREF="../TkLib/GetUid.htm">Tk_Uid</A>, which may be used just like a string pointer but also has the properties of a unique identifier (see the manual entry for <B><A HREF="../TkLib/GetUid.htm">Tk_GetUid</A></B> for details). <P> The <B>Tk_PathName</B> macro returns a hierarchical name for <I>tkwin</I>. Path names have a structure similar to file names in Unix but with dots between elements instead of slashes: the main window for an application has the path name ``.''; its children have names like ``.a'' and ``.b''; their children have names like ``.a.aa'' and ``.b.bb''; and so on. A window is considered to be be a child of another window for naming purposes if the second window was named as the first window's <I>parent</I> when the first window was created. This is not always the same as the X window hierarchy. For example, a pop-up is created as a child of the root window, but its logical parent will usually be a window within the application. <P> The procedure <B>Tk_NameToWindow</B> returns the token for a window given its path name (the <I>pathName</I> argument) and another window belonging to the same main window (<I>tkwin</I>). It normally returns a token for the named window, but if no such window exists <B>Tk_NameToWindow</B> leaves an error message in <I>interp->result</I> and returns NULL. The <I>tkwin</I> argument to <B>Tk_NameToWindow</B> is needed because path names are only unique within a single application hierarchy. If, for example, a single process has opened two main windows, each will have a separate naming hierarchy and the same path name might appear in each of the hierarchies. Normally <I>tkwin</I> is the main window of the desired hierarchy, but this need not be the case: any window in the desired hierarchy may be used. <H3><A NAME="M6">KEYWORDS</A></H3> <A href="../Keywords/N.htm#name">name</A>, <A href="../Keywords/P.htm#path name">path name</A>, <A href="../Keywords/T.htm#token">token</A>, <A href="../Keywords/W.htm#window">window</A> <HR><PRE> <A HREF="../copyright.htm">Copyright</A> © 1990 The Regents of the University of California. <A HREF="../copyright.htm">Copyright</A> © 1994-1997 Sun Microsystems, Inc. <A HREF="../copyright.htm">Copyright</A> © 1995-1997 Roger E. Critchlow Jr.</PRE> </BODY></HTML>