Tcl/Tk 8.5 vs iwidget 4.0.2

93 views
Skip to first unread message

Larry W. Virden

unread,
Aug 18, 2008, 3:10:48 PM8/18/08
to
Hi! I have a developer who is trying Tcl/Tk 8.5 out with a program
that he has been using with Tcl/Tk 8.4 . He mentioned some iwidget
behavior differences.

For instance, he writes:

In the disjointlistbox widget the buttonplacement configuration
parameter seems to be ignored. In my application it is set to center,
and it is centered in 8.4 but not 8.5. Has there been a 8.5 Iwidget
release to correspond with the tcl8.4 release? Also noticed some
widget background color differences. Where in tcl84 fields and
listboxes have gray backgrounds (default) and in tcl85 they are
white.

I'm noticing changes mostly in the widgets, appear to be cosmetic,
except for the -buttonplacement configuration parameter that is
ignored in the disjointlistbox IWidget.

What kinds of changes has to be made to an Iwidgets program to get,
for instance, the widget background colors back to gray? And what
about the disjointlistbox widget's button placement? Is that no longer
supported, or is there a new argument that helps with this?

And is Iwidgets 4.0.2 the right version to be using with Tcl/Tk 8.5.4?

Larry W. Virden

unread,
Aug 18, 2008, 3:18:43 PM8/18/08
to
Here's a code example:
$ cat example.tcl
#
----------------------------------------------------------------------
# DEMO: disjointlistbox in [incr Widgets]
#
----------------------------------------------------------------------
package require Iwidgets 4.0

iwidgets::disjointlistbox .dlb -buttonplacement center -lhslabeltext
"Left Side"
\
-rhslabeltext "Right Side"
pack .dlb -padx 10 -pady 10 -fill both -expand yes

.dlb insertlhs {black white red blue yellow green magenta}

$

When I run the above code using tclsh8.4, the left and right side
buttons appear near the center of the listbox.
When I run the above code using tclsh8.5.4, the left and right side
buttons appear near the top of the two listboxes.

Uwe Schmitz

unread,
Aug 19, 2008, 6:14:39 PM8/19/08
to
Larry,

this happens due to an incompatibility between
grid command of 8.4 and 8.5.

In 8.4 a grid layout, which is smaller than
its containing widget, is always centered.

In 8.5 grid has a new "anchor" subcommand,
through which this behaviour can be specified
in detail. Unfortunately "nw" was chosen as
default. Thus all layouts which are based on
the 8.4 "center" behaviour are broken.

So it's not an incompatibility of the
iwidgets package. Let me know, if you need a
patch for disjointlistbox.tcl. But IMHO a
better way is to change the default of
"grid anchor" to "center" for Tk8.5.

Uwe

Larry W. Virden

unread,
Aug 20, 2008, 7:17:08 AM8/20/08
to
On Aug 19, 6:14 pm, Uwe Schmitz <uwe.schm...@bezreg-koeln.nrw.de>
wrote:

> Let me know, if you need a
> patch for disjointlistbox.tcl. But IMHO a
> better way is to change the default of
> "grid anchor" to "center" for Tk8.5.
>
> Uwe

Have you filed a bug report on this in the Tk database? Is there a
coding work around that can be used until either Iwidgets or Tk has
changed?

Uwe Schmitz

unread,
Aug 20, 2008, 5:52:04 PM8/20/08
to
>
> Have you filed a bug report on this in the Tk database?
Done. Ticket 2062394

> Is there a
> coding work around that can be used until either Iwidgets or Tk has
> changed?

Here is a patch for disjointlistbox:
<patch>
*** pkg/iwidgets4.0.2/scripts/disjointlistbox.itk Tue Aug 12 11:56:03
2003
--- new/iwidgets4.0.2/scripts/disjointlistbox.itk Wed Aug 20 16:47:34
2008
***************
*** 462,467 ****
--- 462,470 ----
grid configure $itk_component(bbox) \
-in $itk_interior -row 0 -column 1 -
columnspan 1 \
-sticky nsew
+ # Tk8.5: enforce compatibility to previous versions
+ # see Tk-ticket 2062394
+ catch {grid anchor $itk_component(bbox) center}

grid configure $itk_component(rhsbutton) \
-in $itk_component(bbox) -row 0 -column 0 -
sticky ew
</patch>
A general patch, that heals all incompatibilities, needs
to overload grid and execute "grid anchor ... center"
for all master widgets (the first time they are involved).
Not that easy, but worth to consider.

Aah yes, concerning the color differences between 8.4 and
8.5: there seems to be a different handling of option
database settings between 8.4 and 8.5. I don't know exactly
where the problem is, but I noticed ticket 2049429 which
may be related. FYI, on my machine the disjointlistbox
has the same background no matter what version I use.

Larry W. Virden

unread,
Aug 21, 2008, 10:44:11 AM8/21/08
to
On Aug 20, 5:52 pm, Uwe Schmitz <uwe.schm...@bezreg-koeln.nrw.de>
wrote:

> > Have you filed a bug report on this in the Tk database?
>
> Done. Ticket 2062394
>
> > Is there a
> > coding work around that can be used until either Iwidgets or Tk has
> > changed?
>
> Here is a patch for disjointlistbox:


Thank you so much. I really appreciate your help. I notice that the
most recent iwidgets cvs snapshot has this entry in its changelog:

2008-08-20 Jeff Hobbs <je...@ActiveState.com>

* generic/disjointlistbox.itk (::iwidgets::disjointlistbox): fix
8.5 grid anchoring. [Bug 2062394]


And the code appears to be your patch.

My developers have been reporting another issue. While the first
report was from Iwidgets 4.0.2, this may be a more general Tk problem
as well. They have noticed some widget background color differences.
In tcl84 fields and listboxes have gray backgrounds (default) and in
tcl85 they are white.

Is there a simple way for an application to tell Tk 8.5 to use the old
colors? I'd hate for the developers to have to change dozens (or
hundreds, etc.) of widget configurations to force Tk 8.5 to do what Tk
8.4 did by default...

Gerald W. Lester

unread,
Aug 21, 2008, 10:54:32 AM8/21/08
to
Larry W. Virden wrote:
> ...

>
> My developers have been reporting another issue. While the first
> report was from Iwidgets 4.0.2, this may be a more general Tk problem
> as well. They have noticed some widget background color differences.
> In tcl84 fields and listboxes have gray backgrounds (default) and in
> tcl85 they are white.
>
> Is there a simple way for an application to tell Tk 8.5 to use the old
> colors? I'd hate for the developers to have to change dozens (or
> hundreds, etc.) of widget configurations to force Tk 8.5 to do what Tk
> 8.4 did by default...

Yes, have them set in the option database the background color for the class
of widget. See the option (NOTE -- no "s" on the end), options (with the
"s") and particular class man/help page.


--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+

Jeff Hobbs

unread,
Aug 21, 2008, 11:07:12 AM8/21/08
to

tk::classic::restore, but there are good reasons for the changes.

Jeff

Larry W. Virden

unread,
Aug 21, 2008, 12:09:36 PM8/21/08
to
On Aug 21, 11:07 am, Jeff Hobbs <jeff.ho...@gmail.com> wrote:

> > Is there a simple way for an application to tell Tk 8.5 to use the old
> > colors? I'd hate for the developers to have to change dozens (or
> > hundreds, etc.) of widget configurations to force Tk 8.5 to do what Tk
> > 8.4 did by default...
>
> tk::classic::restore, but there are good reasons for the changes.
>
> Jeff


Jeff, since I don't see a man page for tk::classic;:restore, and I
don't, yet, see a wiki page for it, can you share a bit more detail
for the consequences of using it - what "good reasons" are going to be
countered?

Right now, in my case, the applications are running on one platform.
There's no issue about compatibility with MacOS or Windows. I'm
guessing this command "turns off" some of the hard work you and some
of the others put into making Tk look "more contemporary". Are there
any other consequences as well?

Thanks!

Jeff Hobbs

unread,
Aug 21, 2008, 1:54:18 PM8/21/08
to

No, it's basically the latter. You can look at lib/tk8.5/obsolete.tcl
(the filename should be a good indicator ;) ) to see what exactly is
restored. Mostly color, with a few borderwidth and font changes.

Jeff

Reply all
Reply to author
Forward
0 new messages