projman/hlp/en/tk/loadTk.htm
2015-10-19 14:27:31 +04:00

66 lines
3.5 KiB
HTML

<HTML><HEAD><TITLE>Tk Tk Built-In Commands - Safe manual page</TITLE></HEAD><BODY>
<H3><A NAME="M2">NAME</A></H3>
loadTk - Load Tk into a safe interpreter.
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B>::safe::loadTk </B><I>slave</I> ?<B>-use</B> <I>windowId</I>? ?<B>-display</B> <I>displayName</I>? <BR>
Safe Tk is based on Safe Tcl, which provides a mechanism
that allows restricted and mediated
access to auto-loading and packages for safe interpreters.
Safe Tk adds the ability to configure the interpreter
for safe Tk operations and load Tk into safe
interpreters.
<H3><A NAME="M4">DESCRIPTION</A></H3>
The <B>::safe::loadTk</B> command initializes the required data structures
in the named safe interpreter and then loads Tk into it.
The command returns the name of the safe interpreter.
If <B>-use</B> is specified, the window identified by the specified system
dependent identifier <I>windowId</I> is used to contain the ``.''
window of the safe interpreter; it can be any valid id, eventually
referencing a window belonging to another application. As a convenience,
if the window you plan to use is a Tk Window of the application you
can use the window name (eg: <B>.x.y</B>) instead of its window Id
(<B>[winfo id .x.y]</B>).
When <B>-use</B> is not specified,
a new toplevel window is created for the ``.'' window of
the safe interpreter. On X11 if you want the embedded window
to use another display than the default one, specify it with
<B>-display</B>.
See the <B>SECURITY ISSUES</B> section below for implementation details.
<H3><A NAME="M5">SECURITY ISSUES</A></H3>
Please read the <B>safe</B> manual page for Tcl to learn about the basic
security considerations for Safe Tcl.
<P>
<B>::safe::loadTk</B> adds the value of <B>tk_library</B> taken from the master
interpreter to the virtual access path of the safe interpreter so that
auto-loading will work in the safe interpreter.
<P>
<P>
Tk initialization is now safe with respect to not trusting
the slave's state for startup. <B>::safe::loadTk</B>
registers the slave's name so
when the Tk initialization (<B><A HREF="../TclLib/Tk_Init.htm">Tk_SafeInit</A></B>) is called
and in turn calls the master's <B>::safe::InitTk</B> it will
return the desired <B>argv</B> equivalent (<B>-use</B>
<I>windowId</I>, correct <B>-display</B>, etc...).
<P>
When <B>-use</B> is not used, the new toplevel created is specially
decorated so the user is always aware that the user interface presented comes
from a potentially unsafe code and can easily delete the corresponding
interpreter.
<P>
On X11, conflicting <B>-use</B> and <B>-display</B> are likely
to generate a fatal X error.
<H3><A NAME="M6">SEE ALSO</A></H3>
<B>safe</B>, <B><A HREF="../TkCmd/interp.htm">interp</A></B>, <B>library</B>, <B><A HREF="../TkCmd/load.htm">load</A></B>, <B><A HREF="../TkCmd/package.htm">package</A></B>, <B><A HREF="../TkCmd/source.htm">source</A></B>, <B><A HREF="../TkCmd/unknown.htm">unknown</A></B>
<H3><A NAME="M7">KEYWORDS</A></H3>
<A href="../Keywords/A.htm#alias">alias</A>, <A href="../Keywords/A.htm#auto-loading">auto-loading</A>, <A href="../Keywords/A.htm#auto_mkindex">auto_mkindex</A>, <A href="../Keywords/L.htm#load">load</A>, <A href="../Keywords/M.htm#master interpreter">master interpreter</A>, <A href="../Keywords/S.htm#safe
interpreter">safe
interpreter</A>, <A href="../Keywords/S.htm#slave interpreter">slave interpreter</A>, <A href="../Keywords/S.htm#source">source</A>
<HR><PRE>
<A HREF="../copyright.htm">Copyright</A> &#169; 1995-1996 Sun Microsystems, Inc.
<A HREF="../copyright.htm">Copyright</A> &#169; 1995-1997 Roger E. Critchlow Jr.</PRE>
</BODY></HTML>