1Tk_CreateEventHandler(3)     Tk Library Procedures    Tk_CreateEventHandler(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tk_CreateEventHandler,   Tk_DeleteEventHandler  -  associate  procedure
9       callback with an X event
10

SYNOPSIS

12       #include <tk.h>
13
14       Tk_CreateEventHandler(tkwin, mask, proc, clientData)
15
16       Tk_DeleteEventHandler(tkwin, mask, proc, clientData)
17

ARGUMENTS

19       Tk_Window       tkwin        (in)      Token for window in which events
20                                              may occur.
21
22       unsigned long   mask         (in)      Bit-mask of events (such as But‐
23                                              tonPressMask)  for  which   proc
24                                              should be called.
25
26       Tk_EventProc    *proc        (in)      Procedure  to invoke whenever an
27                                              event in mask occurs in the win‐
28                                              dow given by tkwin.
29
30       ClientData      clientData   (in)      Arbitrary one-word value to pass
31                                              to proc.
32_________________________________________________________________
33
34

DESCRIPTION

36       Tk_CreateEventHandler arranges for proc to be  invoked  in  the  future
37       whenever  one of the event types specified by mask occurs in the window
38       specified by tkwin.  The callback to  proc  will  be  made  by  Tk_Han‐
39       dleEvent;  this  mechanism  only works in programs that dispatch events
40       through Tk_HandleEvent  (or  through  other  Tk  procedures  that  call
41       Tk_HandleEvent, such as Tk_DoOneEvent or Tk_MainLoop).
42
43       Proc should have arguments and result that match the type Tk_EventProc:
44              typedef void Tk_EventProc(
45                ClientData clientData,
46                XEvent *eventPtr);
47       The  clientData  parameter to proc is a copy of the clientData argument
48       given to Tk_CreateEventHandler when the callback  was  created.   Typi‐
49       cally,  clientData  points  to a data structure containing application-
50       specific information about the window  in  which  the  event  occurred.
51       EventPtr  is  a  pointer  to the X event, which will be one of the ones
52       specified in the mask argument to Tk_CreateEventHandler.
53
54       Tk_DeleteEventHandler may be  called  to  delete  a  previously-created
55       event  handler:   it deletes the first handler it finds that is associ‐
56       ated with tkwin and matches the mask, proc, and  clientData  arguments.
57       If  no  such  handler exists, then Tk_HandleEvent returns without doing
58       anything.  Although Tk supports it, it's probably a bad  idea  to  have
59       more  than  one callback with the same mask, proc, and clientData argu‐
60       ments.  When a window is deleted all of its handlers  will  be  deleted
61       automatically;   in  this  case there is no need to call Tk_DeleteEven‐
62       tHandler.
63
64       If multiple handlers are declared for the same type of X event  on  the
65       same  window,  then the handlers will be invoked in the order they were
66       created.
67
68

KEYWORDS

70       bind, callback, event, handler
71
72
73
74Tk                                                    Tk_CreateEventHandler(3)
Impressum