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
19

ARGUMENTS

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

DESCRIPTION

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

KEYWORDS

66       grab, window
67
68
69
70Tk                                                                  Tk_Grab(3)
Impressum