Justifying labels inside a table

Hi,

I have a bunch of Gtk::Labels inside a Gtk::Table. I want all the
labels on the left hand side of the table to be left-justified. In
other words, all the left labels’ text should be against the left
border of the table.

Any ideas? I can’t figure out how from the documentation. I tried
adding the label to a Gtk::Alignment object, and then packing the
alignment object into a table, but that didn’t work.

Joe Van D. wrote:

Hi,

I have a bunch of Gtk::Labels inside a Gtk::Table. I want all the
labels on the left hand side of the table to be left-justified. In
other words, all the left labels’ text should be against the left
border of the table.

Any ideas? I can’t figure out how from the documentation. I tried
adding the label to a Gtk::Alignment object, and then packing the
alignment object into a table, but that didn’t work.

Set the horizontal packing of the labels to fill but not expand, then
set the x align to zero for left justification and 1 for right
justification. Hope this helps.

Is it possible to do this with other widgets inside a table such as
entry fields?

am Mon, 4 May 2009 05:29:45 +0200, tat Miles K.
[email protected] der Welt kund:

Hi,

Is it possible to do this with other widgets inside a table such as
entry fields?

just put the widgets in Gtk::Alignment(s)

Cheers, detlef


http://det.cable.nu

am Mon, 4 May 2009 13:45:24 +0200, tat Miles K.
[email protected] der Welt kund:

Hi,

I actually had tried that like but used :

table.attach(ef,1, 2, 1,2, Gtk::SHRINK,Gtk::SHRINK,0,0)

I’m not sure why the SHRINK screws it up but doing :

table.attach_defaults(ef,1, 2, 1,2)

works as it should.

that is, cause the alignment only allocates that much space that it’s
child requests. If you use Gtk::SHRINK, the alignment forwards the
“request-only-that-much-space-that-you-need” from the table cell to it’s
child widget.

To get what you expect you have to use the attach_defaults or

table.attach ef,1,2,1,2,Gtk::EXPAND|Gtk::FILL,Gtk::EXPAND|Gtk::FILL,0,0

Cheers, detlef


http://det.cable.nu

Detlef R. wrote:

am Mon, 4 May 2009 05:29:45 +0200, tat Miles K.
[email protected] der Welt kund:

Hi,

Is it possible to do this with other widgets inside a table such as
entry fields?

just put the widgets in Gtk::Alignment(s)

Thanks mate.

I actually had tried that like but used :

table.attach(ef,1, 2, 1,2, Gtk::SHRINK,Gtk::SHRINK,0,0)

I’m not sure why the SHRINK screws it up but doing :

table.attach_defaults(ef,1, 2, 1,2)

works as it should.

Cheers.