The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#  Copyright (c) 1994 The Regents of the University of California.
#  Copyright (c) 1994-1997 Sun Microsystems, Inc.
#  See the file "license.terms" for information on usage and redistribution
#  of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
#

=head1 NAME

Tk_SetAppName - Set the name of an application for ``send'' commands

=for category C Programming

=head1 SYNOPSIS

B<#include E<lt>tk.hE<gt>>

char *
B<Tk_SetAppName>(I<tkwin, name>)

=head1 ARGUMENTS

=over 4

=item Tk_Window tkwin (in)

Token for window in application.  Used only to select a particular
application.

=item char *name (in)

Name under which to register the application.

=back

=head1 DESCRIPTION

B<Tk_SetAppName> associates a name with a given application and
records that association on the display containing with the application's
main window.
After this procedure has been invoked, other applications on the
display will be able to use the B<send> command to invoke operations
in the application.
If I<name> is already in use by some other application on the
display, then a new name will be generated by appending
``B< #2>'' to I<name>;  if this name is also in use,
the number will be incremented until an unused name is found.
The return value from the procedure is a pointer to the name actually
used.

If the application already has a name when B<Tk_SetAppName> is
called, then the new name replaces the old name.

B<Tk_SetAppName> also adds a B<send> command to the application's
interpreter, which can be used to send commands from this application
to others on any of the displays where the application has windows.

The application's name registration persists until the interpreter is
deleted or the B<send> command is deleted from I<interp>, at which
point the name is automatically unregistered and the application
becomes inaccessible via B<send>.
The application can be made accessible again by calling B<Tk_SetAppName>.

B<Tk_SetAppName> is called automatically by B<Tk_Init>,
so applications don't normally need to call it explicitly.

The command B<tk appname> provides Tcl-level access to the
functionality of B<Tk_SetAppName>.

=head1 KEYWORDS

application, name, register, send command