Post by LucI am working on a package that I guess would be considered a megawidget
and I vaguely remember reading somewhere that widgets (or was it
applications?) that use pack cannot contain widgets that use grid, or
maybe it was the other way around, which means that if my megawidget
uses pack, nobody would be able to use it inside another widget (or
would that be an application?) that already uses grid, or maybe the
other way around, well, you get the idea.
I also vaguely remember reading that "the other way around" was safe
though, that is, one between pack and grid may contain widgets managed
by the other geometry manager.
Is that correct? I can't seem to find that exact information. I guess
I really need to be sure before I make a commitment to either one
(or the other way around).
You seem to be getting something very mixed up.
The rule is that any single widget can only be managed by one "manager"
[1] and all the direct children within a widget have to all be managed
by the same manager (because the manager operates from the parent
widget). Plus you have to obey any additional required parent/child
relationships imposed by the managers (the manual pages will detail
these).
But you can very well nest gridded items inside packed items, or packed
items inside gridded items.
# a 'gridded' item managed by pack
label .l1 -text "Label 1"
label .l2 -text "Label 2"
frame .f1
label .f1.l3 -text "Label 3"
label .f1.l4 -text "label 4"
grid .f1.l3 .f1.l4
pack .l1 .f1 .l2 -side top
# a 'packed' item managed by grid
label .l1 -text "Label 1"
label .l2 -text "Label 2"
frame .f1
label .f1.l3 -text "Label 3"
label .f1.l4 -text "label 4"
pack .f1.l3 .f1.l4 -side top
grid .l1 .f1 .l2
[1] "manager" being one of 'pack', 'place', or 'grid'.