Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "FOCUS 1" | |
132 | .TH FOCUS 1 "2000-12-30" "perl v5.8.0" "User Contributed Perl Documentation" | |
133 | .SH "NAME" | |
134 | focus \- Manage the input focus | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | \&\ \fI$widget\fR\->\fBfocus\fR | |
138 | .PP | |
139 | \&\ \fI$widget\fR\->\fBfocus\fR\fIOption\fR | |
140 | .PP | |
141 | \&\ \fI$widget\fR\->\fBfocusNext\fR | |
142 | .PP | |
143 | \&\ \fI$widget\fR\->\fBfocusPrev\fR | |
144 | .PP | |
145 | \&\ \fI$widget\fR\->\fBfocusFollowsMouse\fR | |
146 | .SH "DESCRIPTION" | |
147 | .IX Header "DESCRIPTION" | |
148 | The \fBfocus\fR methods are used to manage the Tk input focus. | |
149 | At any given time, one window on each display is designated as | |
150 | the \fIfocus window\fR; any key press or key release events for the | |
151 | display are sent to that window. | |
152 | It is normally up to the window manager to redirect the focus among the | |
153 | top-level windows of a display. For example, some window managers | |
154 | automatically set the input focus to a top-level window whenever | |
155 | the mouse enters it; others redirect the input focus only when | |
156 | the user clicks on a window. | |
157 | Usually the window manager will set the focus | |
158 | only to top-level windows, leaving it up to the application to | |
159 | redirect the focus among the children of the top\-level. | |
160 | .PP | |
161 | Tk remembers one focus window for each top-level (the most recent | |
162 | descendant of that top-level to receive the focus); when the window | |
163 | manager gives the focus | |
164 | to a top\-level, Tk automatically redirects it to the remembered | |
165 | window. Within a top-level Tk uses an \fIexplicit\fR focus model | |
166 | by default. Moving the mouse within a top-level does not normally | |
167 | change the focus; the focus changes only when a widget | |
168 | decides explicitly to claim the focus (e.g., because of a button | |
169 | click), or when the user types a key such as Tab that moves the | |
170 | focus. | |
171 | .PP | |
172 | The method \fBfocusFollowsMouse\fR may be invoked to | |
173 | create an \fIimplicit\fR focus model: it reconfigures Tk so that | |
174 | the focus is set to a window whenever the mouse enters it. | |
175 | The methods \fBfocusNext\fR and \fBfocusPrev\fR | |
176 | implement a focus order among the windows of a top\-level; they | |
177 | are used in the default bindings for Tab and Shift\-Tab, among other | |
178 | things. | |
179 | .PP | |
180 | The \fBfocus\fR methods can take any of the following forms: | |
181 | .IP "\fI$widget\fR\->\fBfocusCurrent\fR" 4 | |
182 | .IX Item "$widget->focusCurrent" | |
183 | Returns the focus window on the display containing | |
184 | the \fI$widget\fR, or an empty string if no window in | |
185 | this application has the focus on that display. | |
186 | .IP "\fI$widget\fR\->\fBfocus\fR" 4 | |
187 | .IX Item "$widget->focus" | |
188 | If the application currently has the input focus on \fI$widget\fR's | |
189 | display, this command resets the input focus for \fI$widget\fR's display | |
190 | to \fI$widget\fR and returns an empty string. | |
191 | If the application doesn't currently have the input focus on | |
192 | \&\fI$widget\fR's display, \fI$widget\fR will be remembered as the focus | |
193 | for its top\-level; the next time the focus arrives at the top\-level, | |
194 | Tk will redirect it to \fI$widget\fR. | |
195 | .IP "\fI$widget\fR\->\fBfocusForce\fR" 4 | |
196 | .IX Item "$widget->focusForce" | |
197 | Sets the focus of \fI$widget\fR's display to \fI$widget\fR, even if | |
198 | the application doesn't currently have the input focus for the display. | |
199 | This command should be used sparingly, if at all. | |
200 | In normal usage, an application should not claim the focus for | |
201 | itself; instead, it should wait for the window manager to give it | |
202 | the focus. | |
203 | .IP "\fI$widget\fR\->\fBfocusLast\fR" 4 | |
204 | .IX Item "$widget->focusLast" | |
205 | Returns the name of the most recent window to have the input focus | |
206 | among all the windows in the same top-level as \fI$widget\fR. | |
207 | If no window in that top-level has ever had the input focus, or | |
208 | if the most recent focus window has been deleted, then | |
209 | the top-level is returned. The return value is the window that | |
210 | will receive the input focus the next time the window manager gives | |
211 | the focus to the top\-level. | |
212 | .IP "\fI$widget\fR\->\fBfocusNext\fR" 4 | |
213 | .IX Item "$widget->focusNext" | |
214 | .PD 0 | |
215 | .IP "\fI$widget\fR\->\fBfocusPrev\fR" 4 | |
216 | .IX Item "$widget->focusPrev" | |
217 | .PD | |
218 | \&\fBfocusNext\fR is a utility method used for keyboard traversal, but can be | |
219 | useful in other contexts. | |
220 | It sets the focus to the ``next'' window after \fI$widget\fR in focus order. | |
221 | The focus order is determined by | |
222 | the stacking order of windows and the structure of the window hierarchy. | |
223 | Among siblings, the focus order is the same as the stacking order, with the | |
224 | lowest window being first. | |
225 | If a window has children, the window is visited first, followed by | |
226 | its children (recursively), followed by its next sibling. | |
227 | Top-level windows other than \fI$widget\fR are skipped, so that | |
228 | \&\fBfocusNext\fR never returns a window in a different top-level | |
229 | from \fI$widget\fR. | |
230 | .Sp | |
231 | After computing the next window, \fBfocusNext\fR examines the | |
232 | window's \fB\-takefocus\fR option to see whether it should be skipped. | |
233 | If so, \fBfocusNext\fR continues on to the next window in the focus | |
234 | order, until it eventually finds a window that will accept the focus | |
235 | or returns back to \fI$widget\fR. | |
236 | .Sp | |
237 | \&\fBfocusPrev\fR is similar to \fBfocusNext\fR except that it | |
238 | sets the focus to the window just before \fI$widget\fR in the focus order. | |
239 | .IP "\fI$widget\fR\->\fBfocusFollowsMouse\fR" 4 | |
240 | .IX Item "$widget->focusFollowsMouse" | |
241 | \&\fBfocusFollowsMouse\fR changes the focus model for the application | |
242 | to an implicit one where the window under the mouse gets the focus. | |
243 | After this procedure is called, whenever the mouse enters a window | |
244 | Tk will automatically give it the input focus. | |
245 | The \fBfocus\fR command may be used to move the focus to a window | |
246 | other than the one under the mouse, but as soon as the mouse moves | |
247 | into a new window the focus will jump to that window. | |
248 | Note: at present there is no built-in support for returning the | |
249 | application to an explicit focus model; to do this you'll have | |
250 | to write a script that deletes the bindings created by | |
251 | \&\fBfocusFollowsMouse\fR. | |
252 | .SH "QUIRKS" | |
253 | .IX Header "QUIRKS" | |
254 | When an internal window receives the input focus, Tk doesn't actually | |
255 | set the X focus to that window; as far as X is concerned, the focus | |
256 | will stay on the top-level window containing the window with the focus. | |
257 | However, Tk generates FocusIn and FocusOut events just as if the X | |
258 | focus were on the internal window. This approach gets around a | |
259 | number of problems that would occur if the X focus were actually moved; | |
260 | the fact that the X focus is on the top-level is invisible unless | |
261 | you use C code to query the X server directly. | |
262 | .SH "CAVEATS" | |
263 | .IX Header "CAVEATS" | |
264 | Note that for the \fBCanvas\fR widget, the call to \fBfocus\fR has to be | |
265 | fully qualified. This is because there is already a focus method for | |
266 | the \fBCanvas\fR widget, which sets the focus on individual canvas tags. | |
267 | .PP | |
268 | \&\ \fI$canvas\fR\->\fBTk::focus\fR | |
269 | .SH "KEYWORDS" | |
270 | .IX Header "KEYWORDS" | |
271 | events, focus, keyboard, top\-level, window manager |