File: node12.html

package info (click to toggle)
kiwi 1.9.22-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, wheezy
  • size: 11,912 kB
  • ctags: 5,549
  • sloc: python: 15,779; ansic: 193; xml: 77; makefile: 57; sh: 18
file content (138 lines) | stat: -rw-r--r-- 5,824 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="howto.css" type='text/css' />
<link rel="first" href="howto.html" title='Developing applications with Kiwi' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="node13.html" />
<link rel="prev" href="callbacks.html" />
<link rel="parent" href="callbacks.html" />
<link rel="next" href="node13.html" />
<meta name='aesop' content='information' />
<title>2.6.1 Default Widget Focus</title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="2.6 Controllers"
  href="callbacks.html"><img src='previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="2.6 Controllers"
  href="callbacks.html"><img src='up.png'
  border='0' height='32'  alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="2.6.2 Advanced Controllers"
  href="node13.html"><img src='next.png'
  border='0' height='32'  alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Developing applications with Kiwi</td>
<td class='online-navigation'><img src='blank.png'
  border='0' height='32'  alt='' width='32' /></td>
<td class='online-navigation'><img src='blank.png'
  border='0' height='32'  alt='' width='32' /></td>
<td class='online-navigation'><img src='blank.png'
  border='0' height='32'  alt='' width='32' /></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="callbacks.html">2.6 Controllers</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="callbacks.html">2.6 Controllers</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="node13.html">2.6.2 Advanced Controllers</A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->

<H3><A NAME="SECTION000261000000000000000">
2.6.1 Default Widget Focus</A>
</H3>

<P>
An important usability aspect of an application is having focus set by
default to the widget where it is most useful, so the user can start
working right away without having to tab his way through the window's
widgets. If you pay attention, when you first start the <span class="file">faren.py</span>
example, the gtk.Entry for temperature starts with the cursor focus; I've
set the "Has focus" property to True for that widget <I>in Glade</I>.
<code>show*_and_loop()</code> checks your interface before running; if there
is an interactive widget attached to it, and none of the View's widgets
is focused, it prints a warning to standard error explaining the View
doesn't have an interactive widget focused:

<P>
<div class="verbatim"><pre>
    Kiwi warning: no widget is focused in view
        &lt;__main__.FarenView instance at 0x8335444&gt;
    but you have an interactive widget in it:
        &lt;Kiwi.Basic.Entry instance at 0x8774f14&gt;
</pre></div>

<P>
Setting the focused widget in Glade may seem unobvious; if so, you have
alternatives to set focus programatically:

<P>

<UL>
<LI>Call <code>grab_focus()</code> on the specific widget you want to focus.
If you are using a subclassed View, I would recommend doing this at the
end of your View's constructor; otherwise, call it directly before
running <code>show_and_loop()</code>.
</LI>
<LI>Call <code>view.focus_topmost()</code>. For most forms, it makes sense
to focus the form widget most to the top and left when starting up the
application; you can use this convenience function to accomplish that.
</LI>
</UL>

<P>
When using UI composition, remember that the slave view will lose its
focus state when the function <code>attach_slave()</code> is run, so if you
wish to focus a widget that is part of the slave, you will need to do it
explicitly after that function call. If the widget to be focused is in
the parent view, you should have no problems (unless you are swapping
*that* particular widget for the slave, of course).

<P>

<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="2.6 Controllers"
  href="callbacks.html"><img src='previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="2.6 Controllers"
  href="callbacks.html"><img src='up.png'
  border='0' height='32'  alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="2.6.2 Advanced Controllers"
  href="node13.html"><img src='next.png'
  border='0' height='32'  alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Developing applications with Kiwi</td>
<td class='online-navigation'><img src='blank.png'
  border='0' height='32'  alt='' width='32' /></td>
<td class='online-navigation'><img src='blank.png'
  border='0' height='32'  alt='' width='32' /></td>
<td class='online-navigation'><img src='blank.png'
  border='0' height='32'  alt='' width='32' /></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="callbacks.html">2.6 Controllers</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="callbacks.html">2.6 Controllers</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="node13.html">2.6.2 Advanced Controllers</A>
</div>
</div>
<hr />
<span class="release-info">Release 1.9.22, documentation updated on August, 2006.</span>
</DIV>
<!--End of Navigation Panel-->

</BODY>
</HTML>