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 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399
|
<HTML>
<!-- $Id: FAQ.html,v 1.5 2004/12/24 01:27:22 hobbs Exp $ -->
<HEAD>
<TITLE>Tix Frequently Asked Questions</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#800000" ALINK="#800080">
<FONT FACE="Tahoma, Arial, Helvetica">
<center><h1>Tix Frequently Asked Questions</h1></center>
<hr>
<h3>
Legal Issues
</h3>
<DL>
<DT> <b><a name=legal.1> [L.1] </a>
Is Tix free software?
</b><p>
<DD>
<b> ANSWER: </b>
Tix is distributed under the same license as Tcl/Tk (a.k.a. BSD
style license). Application developers can freely redistribute
Tix along with their products. <p>
<p>
</DL>
<hr>
<h3>
General Questions About Using The Tix Library
</h3>
<DL>
<DT> <b><a name=general.1> [G.1] </a>
What does the "<code>-disablecallback</code>"
option do?
</b><p>
<DD>
<b> ANSWER: </b>
Many Tix widgets have both a <code>-value</code> option and a
<code>-command</code> option. Any modification of the
<code>-value</code> will cause the <code>-command</code> callback
to be executed. Sometimes this is undesirable. For example,
calling "<code>config -value</code>" inside the callback procedure
will cause the callback to be re-entered and thus an infinite
recursion. <p>
The <code>-disablecallback</code> can be used to advoid this
problem. When this option is set, the <code>-command</code>
callback will not be executed even if the -value of a widget is
changed. Therefore, if you need to modify the -value of a widget
inside its callback, do this:
<blockquote><pre>
proc my_callback {w} {
$w config -disablecallback true
$w config value blah
$w config -disablecallback false
}
</pre></blockquote>
If you find this too troublesome, you can call the command tixSetSilent:
<blockquote><pre>
proc my_callback {w} {
tixSetSilent $w blah
}
</pre></blockquote>
<p>
<DT> <b><a name=general.2> [G.2] </a>
How do I set the width of the entry subwidget inside the tixControl widget?
</b><p>
<DD>
<b> ANSWER: </b>
You can use the option database or the -options flag to set the
configuration options of the subwidgets. E.g: <pre>
option add *TixControl*entry.width 10
</pre>
OR
<pre>
tixControl .c -options {
entry.width 10
}
</pre>
<p>
<DT> <b><a name=general.6> [G.6] </a>
I am not using the tixForm geometry manager, but it is giving me
errors about TixForm. What happened?
</b><p>
<DD>
<b> ANSWER: </b>
When you get error messages like this:
<pre> (TixForm) Error:Trying to use more than one geometry
manager for the same master window.
Giving up after 50 iterations.</pre>
Most likely, the problem is when using tixLabelFrame widgets, you
packed to the wrong frame: <p>
This is WRONG:
<pre> tixLabelFrame .d
button .d.b
pack .d.b </pre>
This is the correct way:
<pre> tixLabelFrame .d
set f [.d subwidget frame]
button $f.b
pack $f.b
pack .d </pre>
Remember you don't pack directly into a TixLabelFrame
widget. Instead, you should pack into its <code>frame</code>
subwidget.
<p>
<DT> <b><a name=general.7> [G.7] </a>
How do I generate the <code>tclIndex</code> file for Tix?
</b><p>
<DD>
<b> ANSWER: </b>
Tix <code>tclIndex</code> files cannot be generated using the
standard auto_mkindex procedure. You must use the tixindex program
in the <code>tools/</code> subdirectory in the Tix
distribution. The syntax is
<pre> tixindex *.tcl
</pre>
<p>
<DT> <b><a name=general.8> [G.8] </a>
Can I ignore the default arguments passed by the various
<code>-command</code> and <code>-browsecmd</code> options?
</b><p>
<DD>
<b> ANSWER: </b>
You can use the <code>tixBreak</code> command. For example:
<pre> tixFileSelectDialog .c -command "puts foo; tixBreak" </pre>
<p>
<DT> <b><a name=general.9> [G.9] </a>
What does <code>tixWidgetDoWhenIdle</code> do?
</b><p>
<DD>
<b> ANSWER: </b>
It does the same thing as tixDoWhileIdle (and "after -idle"). The
difference is it takes its second argument as the name of a widget
and executes this command only if the widget exists: i.e.:
<pre> tixWidgetDoWhenIdle tixComboBox::Update $w blah blah ..</pre>
will execute tixComboBox::Update only if $w exists. $w may be
destroyed after tixWidgetDoWhenIdle is called but before an idle
event happens.
<p>
<DT> <b><a name=general.feature_req> [G.10] </a>
Why isn't such a feature in Tix? Will it be implemented?
</b><p>
<DD>
<b> ANSWER: </b>
Generally requests for new features are welcomed. You can submit
your requests to <a href=http://tix.sourceforge.net> http://tix.sourceforge.net </a> and
we'll be happy to hear from you. <p>
We can't guarantee to implement the requested features
immediately. Usually it depends on how important the features. If
the feature is requested by more people, it will usually get done
faster.
However, some frequently requested features probably won't be
imlemented. Usually these features are cosmetic changes and:
<ul>
<li> they do not add new capability to the widgets
<li> they are not universally liked
<li> they confuse the user.
</ul>
<p>
Some examples are:
<ul>
<li> <b>Different foreground and background colors for the
NoteBook tabs</b>: having a lot of colors may antagonize the users
that are "color haters"; also, the different colors don't make it
easier for the user to locate the desired tab.
<li> <b>Ring-binder metaphore for the NoteBook widget</b>: a waste
of screen real estate.
<li> <b>Rows of tabs for the NoteBook widget</b>: the user may be
confused when the rows of tabs are switched. If you need to have a
lot of tabs for the notebook, use the ListNoteBook widget instead.
</ul>
<p>
<DT> <b><a name=general.softwares> [G.11] </a>
Who are using Tix in their software?
</b><p>
<DD>
<b> ANSWER: </b>
See <A HREF=http://tix.sourceforge.net>http://tix.sourceforge.net</A>
<p>
<DT> <b><a name=general.twice> [G.12] </a>
I am using a DirList widget. When the user clicks on an item, the
procedure of my <code>-browsecmd</code> gets called
twice. However, I just want it to be called once.
</b><p>
<DD>
<b> ANSWER: </b>
The <code>-browsecmd</code> procedure is triggered by three types
of events: <code><1></code>,
<code><ButtonRelease-1></code>, and
<code><B1-Motion></code>. When the user clicks on an entry,
a <code><1></code> and a
<code><ButtonRelease-1></code> event will happen in rapid
session, which causes your <code>-browsecmd</code> procedure to be
called twice. <p>
A crude fix for this problem is to ignore all the
<code><ButtonRelease-1></code> events. You can find out the
event that triggers the <code>-browsecmd</code> procedure by the
<code>tixEvent</code> command. Here is an example:
<blockquote><pre>
tixDirList .c -browsecmd Browse
proc Browse {args} {
if {[tixEvent type] == "<code><ButtonRelease-1></code>"} {
return
}
# ....
}
</pre></blockquote>
However, the above solution is not perfect. For example, if the
user clicks down the button at entry one, drags it over entries
two and three and release it on top of entry three, the following
events may be caused: <p>
<ol>
<li> <code><1></code> on entry one.
<li> <code><B1-Motion></code> on entry two.
<li> <code><ButtonRelease-1></code> on entry three.
</ol> <p>
Therefore, if you use the above method, the browse event on entry
three will be lost! <p>
To devise a better solution, it's better to understand the basic
design conventions of a Tix-based GUI. Suppose we have a list of
entries displayed in a listbox (or DirList, or HList). When the
user clicks on an entry, the GUI usually responds by displaying a
"<b>detailed view</b>" of the entry. For example, if we put a list
of file names in a listbox, when the user clicks on a file name,
we display the contents of the file in a text window. If the user
then clicks on another file name, the text window will load in the
contents of the new file. <p>
Now what happens if the user clicks on the same entry twice? Do we
reload the contents of the file into the text window? This is
usually unnecessary, inefficient and probably not what the user
wants to do. The Tix convention is, when the user clicks on the
same entry again, the detail view is not updated. If the user
wants to force an update (e.g, the user knows the file's contents
has been changed and wants to see the new version), he or she can
double-click on the entry and the application will respond by
redisplaying the detail view (reloading the file). <p>
To implement this policy, the Browse procedure should be modified
as the following:
<blockquote><pre>
proc Browse {args} {
global currentView
set ent [tixEvent value]
if {$ent == $currentView} {
# We have already displayed the detailed view of $ent.
#
return
} else {
set currentView $ent
DisplayDetail $ent
}
}
</pre></blockquote> <p>
<p>
<DT> <b><a name=general.destroy> [G.13] </a>
I get an error <i>"can't read data(-value): no such element in
array</i>" when I use the tixExFileSelectDialog.
</b><p>
<DD>
<b> ANSWER: </b>
If you use tixExFileSelectDialog like this:
<pre>
tixExFileSelectDialog .f -command foo
foo {filename} {
destroy .f
do some other stuff ...
}
</pre>
it will cause a Tcl error because the dialog assumes that it still
exists after calling your command. This usually result in errors like
this:
<pre>
can't read "data(-value)": no such element in array
while executing
"set data(-selection) $data(-value)..."
(procedure "tixComboBox::SetValue" line 30)
</pre>
This "feature" is built into many Tix widgets and can't be fixed
easily. To work around the problem, never destroy widgets inside
-command calls. Usually you should unmap toplevel windows
instead. If you must destroy widgets, do it with an "after"
command. For example, the foo procedure should be rewritten as:
<pre>
foo {filename} {
wm withdraw .f
do some other stuff ...
after idle {if [winfo exists .f] {destroy .f}}
}
</pre>
Execute the "after" command at the very end of the
-command. Otherwise the idle handler may be activated by some
"update" calls.
<p>
</DL>
<hr>
<h3>
Question About Porting to Specific Platforms/Software
</h3>
<DL>
<DT> <b><a name=port.1> [P.1] </a>
The configure script gave me strange errors.
</b><p>
<DD>
<b> ANSWER: </b>
The problem may be you have several operating systems sharing the
same file system. Some people encounter error messages like this:
<blockquote><pre>
# ./configure --prefix=/usr/vendor/tcl
loading cache ./config.cache
checking for a BSD compatible install... /usr/bin/installbsd -c
checking for ranlib... ranlib
checking how to run the C preprocessor... cc -E
checking for unistd.h... ./configure[603]: "${ac_cv_header_$ac_safe+set}": bad
substitution
</pre></blockquote>
The problem is at line 2, configure loaded in ./config.cache,
which may have been created by a different operating system, with
settings only usuable for that operating system. To get around
this, you should type
<blockquote><pre>
make distclean
./configure
make all
</pre></blockquote>
|