Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Pack/grid sensitive to order of creation, possible bug?

8 views
Skip to first unread message

Twylite

unread,
Oct 12, 2007, 4:48:13 AM10/12/07
to
Hi,

One of my colleagues noticed that pack/grid seem to be sensitive to
order of creation of the widgets. See the examples below:

# Doesn't work
label .lab1 -text "hello"
frame .f -bg red -borderwidth 2
pack .f -side bottom
pack .lab1 -in .f

# Works
frame .f -bg red -borderwidth 2
label .lab1 -text "hello"
pack .f -side bottom
pack .lab1 -in .f


In the first example there are no errors but the label doesn't appear
anywhere. In the second example the frame is created first, and it
works. Can be reproduced using toplevel "." or any other toplevel.

System is Windows 2000 (latest patches) with Tcl 8.5a6 (wish compiled
using MSVC from SF sources).

Is there some known interaction here that I should know of, or is this
a bug?

Regards,
Twylite

Bryan Oakley

unread,
Oct 12, 2007, 6:07:13 AM10/12/07
to
Twylite wrote:
> Hi,
>
> One of my colleagues noticed that pack/grid seem to be sensitive to
> order of creation of the widgets.

Yes, that is true, more or less. Widgets have a stacking order that is
initially determined by the order that they are created. You can change
that stacking order with the commands "raise" and "lower".

This is a feature, not a bug, and can be used for some interesting effects.

I wrote a short article about this a while ago, if you're interested.

http://www.tclscripting.com/articles/feb06/article3.html

Jeff Hobbs

unread,
Oct 12, 2007, 3:24:04 PM10/12/07
to Twylite
Twylite wrote:
> One of my colleagues noticed that pack/grid seem to be sensitive to
> order of creation of the widgets. See the examples below:

Yes, that is true, but what you should is not a bug, rather just pilot
error. Order of creation defines the default order of display. If you
create a frame after a label and pack the label in the frame, you
wouldn't expect to see the label. See 'raise', but it also looks like
an awkward use of geometry management.

Jeff

0 new messages