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

NAME

8       Tk_Grab, Tk_Ungrab - manipulate grab state in an application
9

SYNOPSIS

11       #include <tk.h>
12
13       int
14       Tk_Grab(interp, tkwin, grabGlobal)
15
16       void
17       Tk_Ungrab(tkwin)
18

ARGUMENTS

20       Tcl_Interp *interp (in)                   Interpreter  to use for error
21                                                 reporting
22
23       Tk_Window tkwin (in)                      Window on  whose  behalf  the
24                                                 pointer  is  to be grabbed or
25                                                 released
26
27       int grabGlobal (in)                       Boolean  indicating   whether
28                                                 the  grab is global or appli‐
29                                                 cation local
30______________________________________________________________________________
31

DESCRIPTION

33       These functions are used to set or release a global or application  lo‐
34       cal  grab.   When a grab is set on a particular window in a Tk applica‐
35       tion, mouse and keyboard events can only be received by that window and
36       its  descendants.   Mouse  and  keyboard events for windows outside the
37       tree rooted at tkwin will be redirected  to  tkwin.   If  the  grab  is
38       global, then all mouse and keyboard events for windows outside the tree
39       rooted at tkwin (even those intended for windows in other applications)
40       will  be  redirected  to tkwin.  If the grab is application local, only
41       mouse and keyboard events intended for a windows within the same appli‐
42       cation (but outside the tree rooted at tkwin) will be redirected.
43
44       Tk_Grab sets a grab on a particular window.  Tkwin specifies the window
45       on whose behalf the pointer is to  be  grabbed.   GrabGlobal  indicates
46       whether  the  grab should be global or application local; if it is non-
47       zero, it means the grab should be global.   Normally,  Tk_Grab  returns
48       TCL_OK; if an error occurs and the grab cannot be set, TCL_ERROR is re‐
49       turned and an error message is left if interp's result.  Once this call
50       completes successfully, no window outside the tree rooted at tkwin will
51       receive pointer- or keyboard-related events  until  the  next  call  to
52       Tk_Ungrab.   If  a  previous grab was in effect within the application,
53       then it is replaced with a new one.
54
55       Tk_Ungrab releases a grab on the mouse pointer and keyboard,  if  there
56       is  one  set  on  the  window given by tkwin.  Once a grab is released,
57       pointer and keyboard events will start being delivered to other windows
58       again.
59

KEYWORDS

61       grab, window
62
63
64
65Tk                                                                  Tk_Grab(3)
Impressum