And then I want a "command" that says: start a new line, thus create this:
[A][ B ][C]
[ D ][ E ]
[ F ]
(How) can I do this?
--
------------------------------------
Gernot Frisch
http://www.glbasic.com
Are you saying you want this command to actually add two lines as in
your diagram, where one line has two widgets and the next has one?
It's not clear what you're wanting to do.
Are you having problems understanding how to add a line, or how to get
the widgets to expand properly, or both?
> Are you saying you want this command to actually add two lines as in
> your diagram, where one line has two widgets and the next has one?
> It's not clear what you're wanting to do.
>
> Are you having problems understanding how to add a line, or how to get
> the widgets to expand properly, or both?
My problem is, that "pack" can either pack them A-B-C, or
A
B
C
But not
A-B-C
D-E-F
So, I'm asking how to pack3 widgets side by side, and then a different count
of widgets side by side _below_ the first ones.
Either with nested frames:
pack [frame .1]
pack .1.a .1.b .1.c -side left
pack [frame .2]
pack .2.d .2.e
pack .f
or with [grid]:
grid .a .b - .c
grid .d - .e -
grid .f - - -
The alternative is to use the grid packer ( or blt_table )
you can give row and column positions and adjust rowspan/colspan.
see man n grid
uwe
As others have said, the common solution is to use nested frames. You
can create almost any sort of layout with that scheme.
Don't let multiple frames scare you. Look at them as a tool rather
than an obstacle. You don't have to make your significant widgets a
child of a deeply nested hierarchy. Make use of the -in option to make
it easy to change your layout without having to rename your widgets.
For example, *instead* of this:
frame .container
frame .container.row1
frame .container.row1.column1
...
button .container.row1.column1.button1
pack .container.row1.column1.button1
Do this:
frame .container
frame .container.row1
frame .container.row1.column1
...
button .button1
pack .button1 -in .container.row1.column1
This makes it easy to, in effect, separate your presentation (the
layers of frames) from your content (loosely speaking, non-frame
widgets). If you later decide you need more nested frames to get
things right you only have to add the frames and adjust the packing,
you don't have to go and rename all your buttons, entry widgets and so
on throughout your code.
I typically do something "in between" like this:
set container [frame .container]
set row1 [frame $container.row1]
set r1c1 [frame $row1.column1]
...
set b [button $r1c1.button1]
pack $b
That way, if I need to move the button or add more layers of nesting, I
just need to change the path variable.
--
Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous
[grid] would definitely be my advice here. I rarely use [pack] these
days, except for very simple layouts (i.e. just one or two widgets).
Also look at grid column/rowconfigure commands.
-- Neil
If you must use pack, other posters have shown how to do it. If not,
check out grid command. It is very flexible. As a matter of fact,
there was an entire GUI generation tool called SpecTcl which was based
on grid.
>> And then I want a "command" that says: start a new line, thus create
>> this:
>>
>> [A][ B ][C]
>> [ D ][ E ]
>> [ F ]
>>
>> (How) can I do this?
>
>
> If you must use pack, other posters have shown how to do it. If not,
> check out grid command. It is very flexible. As a matter of fact,
> there was an entire GUI generation tool called SpecTcl which was based
> on grid.
Yes, I want pack, and yes, it works great with the frames.