Re: [gtk-list] alignment oddity



Nils Philippsen wrote:
> 
> Hi.
> 
> Can someone please tell me why the following doesn't work (or better: how
> I get it working):
> 
>     label = gtk_label_new (_("New:"));
>     gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
>     gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
>                       0, 0, 0, 0);
>     gtk_widget_show (label);
> 
> Actually, the label should get left-justified in the table cell, despite
> it's centered. From gtk+-1.0 times I knew you had to perform the function
> calls in a special order, so I shuffled the stuff around, to no avail.

You need to add GTK_FILL to the xoptions argument:

     gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
                       GTK_FILL, 0, 0, 0);

If you don't do that, the label is allocated the exact amount of space
it needs, and is placed in the middle of the table cell.
Setting the alignment then has no effect.


Damon




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]