Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bd5c3d824c3db63ffd9226c15941e6ad > files > 2168

mozart-1.4.0-1mdv2010.0.i586.rpm

<HTML><HEAD><TITLE>Library Procedures - Tk_CreateEventHandler manual page</TITLE></HEAD><BODY>
<H3><A NAME="M2">NAME</A></H3>
Tk_CreateEventHandler, Tk_DeleteEventHandler - associate procedure callback with an X event
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B>#include &lt;tk.h&gt;</B><BR>
<B>Tk_CreateEventHandler</B>(<I>tkwin, mask, proc, clientData</I>)<BR>
<B>Tk_DeleteEventHandler</B>(<I>tkwin, mask, proc, clientData</I>)<BR>
<H3><A NAME="M4">ARGUMENTS</A></H3>
<DL>
<P><DT>Tk_Window <B>tkwin</B> (in)<DD>
Token for window in which events may occur.
<P><DT>unsigned long <B>mask</B> (in)<DD>
Bit-mask of events (such as <B>ButtonPressMask</B>)
for which <I>proc</I> should be called.
<P><DT>Tk_EventProc <B>*proc</B> (in)<DD>
Procedure to invoke whenever an event in <I>mask</I> occurs
in the window given by <I>tkwin</I>.
<P><DT>ClientData <B>clientData</B> (in)<DD>
Arbitrary one-word value to pass to <I>proc</I>.
<P></DL>
<H3><A NAME="M5">DESCRIPTION</A></H3>
<B>Tk_CreateEventHandler</B> arranges for <I>proc</I> to be
invoked in the future whenever one of the event types specified
by <I>mask</I> occurs in the window specified by <I>tkwin</I>.
The callback to <I>proc</I> will be made by <B><A HREF="../TkLib/HandleEvent.htm">Tk_HandleEvent</A></B>;
this mechanism only works in programs that dispatch events
through <B><A HREF="../TkLib/HandleEvent.htm">Tk_HandleEvent</A></B> (or through other Tk procedures that
call <B><A HREF="../TkLib/HandleEvent.htm">Tk_HandleEvent</A></B>, such as <B>Tk_DoOneEvent</B> or
<B><A HREF="../TkLib/MainLoop.htm">Tk_MainLoop</A></B>).
<P>
<I>Proc</I> should have arguments and result that match the
type <B>Tk_EventProc</B>:
<PRE>typedef void Tk_EventProc(
	ClientData <I>clientData</I>,
	XEvent *<I>eventPtr</I>);</PRE>
The <I>clientData</I> parameter to <I>proc</I> is a copy of the <I>clientData</I>
argument given to <B>Tk_CreateEventHandler</B> when the callback
was created.  Typically, <I>clientData</I> points to a data
structure containing application-specific information about
the window in which the event occurred.  <I>EventPtr</I> is
a pointer to the X event, which will be one of the ones
specified in the <I>mask</I> argument to <B>Tk_CreateEventHandler</B>.
<P>
<B>Tk_DeleteEventHandler</B> may be called to delete a
previously-created event handler:  it deletes the first handler
it finds that is associated with <I>tkwin</I> and matches the
<I>mask</I>, <I>proc</I>, and <I>clientData</I> arguments.  If
no such handler exists, then <B>Tk_EventHandler</B> returns
without doing anything.  Although Tk supports it, it's probably
a bad idea to have more than one callback with the same <I>mask</I>,
<I>proc</I>, and <I>clientData</I> arguments.
When a window is deleted all of its handlers will be deleted
automatically;  in this case there is no need to call
<B>Tk_DeleteEventHandler</B>.
<P>
If multiple handlers are declared for the same type of X event
on the same window, then the handlers will be invoked in the
order they were created.

<H3><A NAME="M6">KEYWORDS</A></H3>
<A href="../Keywords/B.htm#bind">bind</A>, <A href="../Keywords/C.htm#callback">callback</A>, <A href="../Keywords/E.htm#event">event</A>, <A href="../Keywords/H.htm#handler">handler</A>
<HR><PRE>
<A HREF="../copyright.htm">Copyright</A> &#169; 1990 The Regents of the University of California.
<A HREF="../copyright.htm">Copyright</A> &#169; 1994-1996 Sun Microsystems, Inc.
<A HREF="../copyright.htm">Copyright</A> &#169; 1995-1997 Roger E. Critchlow Jr.</PRE>
</BODY></HTML>