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

Notebook needs to be defined before the things you put on it

33 ዕይታዎች
ወደ የመጀመሪያው ያልተነበበ መልዕክት ዝለል

Cecil Westerhof

ያልተነበበ፣
27 ጁን 2018 10:14:05 ጥዋት27/06/2018
I have:
ttk::notebook .nb
listbox .com \
-height 0 \
-listvariable commands \
-exportselection 0
listbox .brew \
-height [llength $teaList] \
-width 50 \
-selectmode single \
-exportselection 0
bind .brew <<ListboxSelect>> [list makeTea .brew]
foreach tea ${teaList} {
dict with tea {
.brew insert end [format {%-30s %-10s %2s} ${Tea} ${LastUsed} ${Location}]
}
}
.nb add .com -text Commands
.nb add .brew -text "Brew Tea"
pack .nb

but earlier I had:
listbox .com \
-height 0 \
-listvariable commands \
-exportselection 0
listbox .brew \
-height [llength $teaList] \
-width 50 \
-selectmode single \
-exportselection 0
bind .brew <<ListboxSelect>> [list makeTea .brew]
foreach tea ${teaList} {
dict with tea {
.brew insert end [format {%-30s %-10s %2s} ${Tea} ${LastUsed} ${Location}]
}
}
ttk::notebook .nb
.nb add .com -text Commands
.nb add .brew -text "Brew Tea"
pack .nb

This did not work: I got empty tabs. What is the reason for this?

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Brad Lanam

ያልተነበበ፣
27 ጁን 2018 10:31:53 ጥዋት27/06/2018
Short answer: stacking order.

When the widgets are created, they are given a stacking order (this is
probably an X window thing from long ago). The display process will
draw the widgets in stacking order, so .com/.brew/.nb will overlay the
notebook on the other widgets. Whereas .nb/.com/.brew will display
as expected.

This can actually be useful in some cases:
ttk::label .hidden -text hidden
ttk::frame .f
pack .f
pack .hidden -in .f
and later:
raise .hidden .f


Ralf Fassel

ያልተነበበ፣
28 ጁን 2018 8:14:40 ጥዋት28/06/2018
* Cecil Westerhof <Ce...@decebal.nl>
| I have:
| ttk::notebook .nb
| listbox .com ...
| listbox .brew ...
| .nb add .com -text Commands
| .nb add .brew -text "Brew Tea"

I find it more natural that the notebook 'contents' are children if the
notebook itself:

ttk::notebook .nb
listbox .nb.com
listbox .nb.brew
.nb add .nb.com -text Commands
.nb add .nb.brew -text "Brew Tea"

That way you a) avoid the stacking order problem, and b) don't have to
handle the lifetime of the listboxes. Destroy the notebook, and the
listboxes are destroyed, too.

My EUR 0.02 & YMMV.
R'
0 አዲስ መልዕክቶች