~ubuntu-branches/ubuntu/vivid/gcl/vivid

« back to all changes in this revision

Viewing changes to info/gcl-tk/grab.html

  • Committer: Package Import Robot
  • Author(s): Camm Maguire
  • Date: 2014-05-16 17:41:33 UTC
  • mto: This revision was merged to the branch mainline in revision 62.
  • Revision ID: package-import@ubuntu.com-20140516174133-czs0uktsjj2vkhxk
2.6.11preĀ testĀ 11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
2
<html>
 
3
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
 
4
<head>
 
5
<title>GCL TK Manual: grab</title>
 
6
 
 
7
<meta name="description" content="GCL TK Manual: grab">
 
8
<meta name="keywords" content="GCL TK Manual: grab">
 
9
<meta name="resource-type" content="document">
 
10
<meta name="distribution" content="global">
 
11
<meta name="Generator" content="makeinfo">
 
12
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 
13
<link href="index.html#Top" rel="start" title="Top">
 
14
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
 
15
<link href="Control.html#Control" rel="up" title="Control">
 
16
<link href="tk_002dlistbox_002dsingle_002dselect.html#tk_002dlistbox_002dsingle_002dselect" rel="next" title="tk-listbox-single-select">
 
17
<link href="focus.html#focus" rel="prev" title="focus">
 
18
<style type="text/css">
 
19
<!--
 
20
a.summary-letter {text-decoration: none}
 
21
blockquote.smallquotation {font-size: smaller}
 
22
div.display {margin-left: 3.2em}
 
23
div.example {margin-left: 3.2em}
 
24
div.indentedblock {margin-left: 3.2em}
 
25
div.lisp {margin-left: 3.2em}
 
26
div.smalldisplay {margin-left: 3.2em}
 
27
div.smallexample {margin-left: 3.2em}
 
28
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
 
29
div.smalllisp {margin-left: 3.2em}
 
30
kbd {font-style:oblique}
 
31
pre.display {font-family: inherit}
 
32
pre.format {font-family: inherit}
 
33
pre.menu-comment {font-family: serif}
 
34
pre.menu-preformatted {font-family: serif}
 
35
pre.smalldisplay {font-family: inherit; font-size: smaller}
 
36
pre.smallexample {font-size: smaller}
 
37
pre.smallformat {font-family: inherit; font-size: smaller}
 
38
pre.smalllisp {font-size: smaller}
 
39
span.nocodebreak {white-space:nowrap}
 
40
span.nolinebreak {white-space:nowrap}
 
41
span.roman {font-family:serif; font-weight:normal}
 
42
span.sansserif {font-family:sans-serif; font-weight:normal}
 
43
ul.no-bullet {list-style: none}
 
44
-->
 
45
</style>
 
46
 
 
47
 
 
48
</head>
 
49
 
 
50
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
 
51
<a name="grab"></a>
 
52
<div class="header">
 
53
<p>
 
54
Next: <a href="tk_002dlistbox_002dsingle_002dselect.html#tk_002dlistbox_002dsingle_002dselect" accesskey="n" rel="next">tk-listbox-single-select</a>, Previous: <a href="focus.html#focus" accesskey="p" rel="prev">focus</a>, Up: <a href="Control.html#Control" accesskey="u" rel="up">Control</a> &nbsp; [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
 
55
</div>
 
56
<hr>
 
57
<a name="grab-1"></a>
 
58
<h3 class="section">3.7 grab</h3>
 
59
 
 
60
<p>grab \- Confine pointer and keyboard events to a window sub-tree
 
61
</p><a name="Synopsis-21"></a>
 
62
<h4 class="unnumberedsubsec">Synopsis</h4>
 
63
<br><p><b>grab&nbsp;</b><span class="roman">?</span><b>:global</b><span class="roman">?&nbsp;</span><i>window</i><!-- /@w --><br>
 
64
<b>grab </b><i>option </i><span class="roman">?arg arg </span>...?
 
65
</p>
 
66
<a name="Description-18"></a>
 
67
<h4 class="unnumberedsubsec">Description</h4>
 
68
 
 
69
<p>This command implements simple pointer and keyboard grabs for Tk.
 
70
Tk&rsquo;s grabs are different than the grabs
 
71
described in the Xlib documentation.
 
72
When a grab is set for a particular window, Tk restricts all pointer
 
73
events to the grab window and its descendants in Tk&rsquo;s window hierarchy.
 
74
Whenever the pointer is within the grab window&rsquo;s subtree, the pointer
 
75
will behave exactly the same as if there had been no grab at all
 
76
and all events will be reported in the normal fashion.
 
77
When the pointer is outside <i>window</i>&rsquo;s tree, button presses and
 
78
releases and
 
79
mouse motion events are reported to <i>window</i>, and window entry
 
80
and window exit events are ignored.
 
81
The grab subtree &ldquo;owns&rdquo; the pointer:
 
82
windows outside the grab subtree will be visible on the screen
 
83
but they will be insensitive until the grab is released.
 
84
The tree of windows underneath the grab window can include top-level
 
85
windows, in which case all of those top-level windows
 
86
and their descendants will continue to receive mouse events
 
87
during the grab.
 
88
</p>
 
89
<p>Two forms of grabs are possible:  local and global.
 
90
A local grab affects only the grabbing application:  events will
 
91
be reported to other applications as if the grab had never occurred.
 
92
Grabs are local by default.
 
93
A global grab locks out all applications on the screen,
 
94
so that only the given subtree of the grabbing application will be
 
95
sensitive to pointer events (mouse button presses, mouse button releases,
 
96
pointer motions, window entries, and window exits).
 
97
During global grabs the window manager will not receive pointer
 
98
events either.
 
99
</p>
 
100
<p>During local grabs, keyboard events (key presses and key releases)
 
101
are delivered as usual:  the window
 
102
manager controls which application receives keyboard events, and
 
103
if they are sent to any window in the grabbing application then they are
 
104
redirected to the focus window.
 
105
During a global grab Tk grabs the keyboard so that all keyboard events
 
106
are always sent to the grabbing application.
 
107
The <b>focus</b> command is still used to determine which window in the
 
108
application receives the keyboard events.
 
109
The keyboard grab is released when the grab is released.
 
110
</p>
 
111
<p>Grabs apply to particular displays.  If an application has windows
 
112
on multiple displays then it can establish a separate grab on each
 
113
display.
 
114
The grab on a particular display affects only the windows on
 
115
that display.
 
116
It is possible for different applications on a single display to have
 
117
simultaneous local grabs, but only one application can have a global
 
118
grab on a given display at once.
 
119
</p>
 
120
<p>The <b>grab</b> command can take any of the following forms:
 
121
</p>
 
122
<dl compact="compact">
 
123
<dt><b>grab </b><span class="roman">?</span><b>:global</b><span class="roman">? </span><i>window</i></dt>
 
124
<dd><p>Same as <b>grab :set</b>, described below.
 
125
</p></dd>
 
126
<dt><b>grab :current </b><span class="roman">?</span><i>window</i>?</dt>
 
127
<dd><p>If <i>window</i> is specified, returns the name of the current grab
 
128
window in this application for <i>window</i>&rsquo;s display, or an empty
 
129
string if there is no such window.
 
130
If <i>window</i> is omitted, the command returns a list whose elements
 
131
are all of the windows grabbed by this application for all displays,
 
132
or an empty string if the application has no grabs.
 
133
</p></dd>
 
134
<dt><b>grab :release </b><i>window</i></dt>
 
135
<dd><p>Releases the grab on <i>window</i> if there is one, otherwise does
 
136
nothing.  Returns an empty string.
 
137
</p></dd>
 
138
<dt><b>grab :set </b><span class="roman">?</span><b>:global</b><span class="roman">? </span><i>window</i></dt>
 
139
<dd><p>Sets a grab on <i>window</i><span class="roman">.  If </span><b>:global</b> is specified then the
 
140
grab is global, otherwise it is local.
 
141
If a grab was already in effect for this application on
 
142
<i>window</i>&rsquo;s display then it is automatically released.
 
143
If there is already a grab on <i>window</i> and it has the same
 
144
global/local form as the requested grab, then the command
 
145
does nothing.  Returns an empty string.
 
146
</p></dd>
 
147
<dt><b>grab :status </b><i>window</i></dt>
 
148
<dd><p>Returns <b>none</b><span class="roman"> if no grab is currently set on </span><i>window</i>,
 
149
<b>local</b><span class="roman"> if a local grab is set on </span><i>window</i>, and
 
150
<b>global</b> if a global grab is set.
 
151
</p>
 
152
</dd>
 
153
</dl>
 
154
<a name="Bugs-2"></a>
 
155
<h4 class="unnumberedsubsec">Bugs</h4>
 
156
 
 
157
<p>It took an incredibly complex and gross implementation to produce
 
158
the simple grab effect described above.
 
159
Given the current implementation, it isn&rsquo;t safe for applications
 
160
to use the Xlib grab facilities at all except through the Tk grab
 
161
procedures.
 
162
If applications try to manipulate X&rsquo;s grab mechanisms directly,
 
163
things will probably break.
 
164
</p>
 
165
<p>If a single process is managing several different Tk applications,
 
166
only one of those applications can have a local grab for a given
 
167
display at any given time.  If the applications are in different
 
168
processes, this restriction doesn&rsquo;t exist.
 
169
</p>
 
170
<a name="Keywords-21"></a>
 
171
<h4 class="unnumberedsubsec">Keywords</h4>
 
172
<p>grab, keyboard events, pointer events, window
 
173
</p><hr>
 
174
<div class="header">
 
175
<p>
 
176
Next: <a href="tk_002dlistbox_002dsingle_002dselect.html#tk_002dlistbox_002dsingle_002dselect" accesskey="n" rel="next">tk-listbox-single-select</a>, Previous: <a href="focus.html#focus" accesskey="p" rel="prev">focus</a>, Up: <a href="Control.html#Control" accesskey="u" rel="up">Control</a> &nbsp; [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
 
177
</div>
 
178
 
 
179
 
 
180
 
 
181
</body>
 
182
</html>