OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [tk/] [doc/] [focus.n] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1990-1994 The Regents of the University of California.
3
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4
'\"
5
'\" See the file "license.terms" for information on usage and redistribution
6
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7
'\"
8
'\" RCS: @(#) $Id: focus.n,v 1.1.1.1 2002-01-16 10:25:49 markom Exp $
9
'\"
10
.so man.macros
11
.TH focus n 4.0 Tk "Tk Built-In Commands"
12
.BS
13
'\" Note:  do not modify the .SH NAME line immediately below!
14
.SH NAME
15
focus \- Manage the input focus
16
.SH SYNOPSIS
17
\fBfocus\fR
18
.sp
19
\fBfocus \fIwindow\fR
20
.sp
21
\fBfocus \fIoption\fR ?\fIarg arg ...\fR?
22
.BE
23
 
24
.SH DESCRIPTION
25
.PP
26
The \fBfocus\fR command is used to manage the Tk input focus.
27
At any given time, one window on each display is designated as
28
the \fIfocus window\fR;  any key press or key release events for the
29
display are sent to that window.
30
It is normally up to the window manager to redirect the focus among the
31
top-level windows of a display.  For example, some window managers
32
automatically set the input focus to a top-level window whenever
33
the mouse enters it;  others redirect the input focus only when
34
the user clicks on a window.
35
Usually the window manager will set the focus
36
only to top-level windows, leaving it up to the application to
37
redirect the focus among the children of the top-level.
38
.PP
39
Tk remembers one focus window for each top-level (the most recent
40
descendant of that top-level to receive the focus);  when the window
41
manager gives the focus
42
to a top-level, Tk automatically redirects it to the remembered
43
window.  Within a top-level Tk uses an \fIexplicit\fR focus model
44
by default.  Moving the mouse within a top-level does not normally
45
change the focus;  the focus changes only when a widget
46
decides explicitly to claim the focus (e.g., because of a button
47
click), or when the user types a key such as Tab that moves the
48
focus.
49
.PP
50
The Tcl procedure \fBtk_focusFollowsMouse\fR may be invoked to
51
create an \fIimplicit\fR focus model:  it reconfigures Tk so that
52
the focus is set to a window whenever the mouse enters it.
53
The Tcl procedures \fBtk_focusNext\fR and \fBtk_focusPrev\fR
54
implement a focus order among the windows of a top-level;  they
55
are used in the default bindings for Tab and Shift-Tab, among other
56
things.
57
.PP
58
The \fBfocus\fR command can take any of the following forms:
59
.TP
60
\fBfocus\fR
61
Returns the path name of the focus window on the display containing
62
the application's main window,  or an empty string if no window in
63
this application has the focus on that display.   Note:  it is
64
better to specify the display explicitly using \fB\-displayof\fR
65
(see below) so that the code will work in applications using multiple
66
displays.
67
.TP
68
\fBfocus \fIwindow\fR
69
If the application currently has the input focus on \fIwindow\fR's
70
display, this command resets the input focus for \fIwindow\fR's display
71
to \fIwindow\fR and returns an empty string.
72
If the application doesn't currently have the  input focus on
73
\fIwindow\fR's display, \fIwindow\fR will be remembered as the focus
74
for its top-level;  the next time the focus arrives at the top-level,
75
Tk will redirect it to \fIwindow\fR.
76
If \fIwindow\fR is an empty string then the command does nothing.
77
.TP
78
\fBfocus \-displayof\fR \fIwindow\fR
79
Returns the name of the focus window on the display containing \fIwindow\fR.
80
If the focus window for \fIwindow\fR's display isn't in this
81
application, the return value is an empty string.
82
.TP
83
\fBfocus \-force \fIwindow\fR
84
Sets the focus of \fIwindow\fR's display to \fIwindow\fR, even if
85
the application doesn't currently have the input focus for the display.
86
This command should be used sparingly, if at all.
87
In normal usage, an application should not claim the focus for
88
itself;  instead, it should wait for the window manager to give it
89
the focus.
90
If \fIwindow\fR is an empty string then the command does nothing.
91
.TP
92
\fBfocus \-lastfor\fR \fIwindow\fR
93
Returns the name of the most recent window to have the input focus
94
among all the windows in the same top-level as \fIwindow\fR.
95
If no window in that top-level has ever had the input focus, or
96
if the most recent focus window has been deleted, then the name
97
of the top-level is returned.  The return value is the window that
98
will receive the input focus the next time the window manager gives
99
the focus to the top-level.
100
 
101
.SH "QUIRKS"
102
.PP
103
When an internal window receives the input focus, Tk doesn't actually
104
set the X focus to that window;  as far as X is concerned, the focus
105
will stay on the top-level window containing the window with the focus.
106
However, Tk generates FocusIn and FocusOut events just as if the X
107
focus were on the internal window.   This approach gets around a
108
number of problems that would occur if the X focus were actually moved;
109
the fact that the X focus is on the top-level is invisible unless
110
you use C code to query the X server directly.
111
 
112
.SH KEYWORDS
113
events, focus, keyboard, top-level, window manager

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.