Re: tables & alignment



Arun Thomas wrote:
> Is there a way to left-justify or right-justify widgets that are
> contained in table cells? I can't find one. It centers them by default.
> (I'm trying to center labels and buttons by the way.
> Gtk::Label::set_justify(GTK_JUSTIFY_LEFT) did nothing. 

Hi Arun, can't you use set_alignment? I do something like:

        tally->but = gtk_button_new();
        gtk_widget_show( tally->but );
        doubleclick_add( tally->but, FALSE,
                tallyrow_single_cb, tally, tallyrow_double_cb, tally );
        tally->label = gtk_label_new( sym->name );
        gtk_misc_set_alignment( GTK_MISC( tally->label ), 1, 0 );
        gtk_misc_set_padding( GTK_MISC( tally->label ), 2, 0 );
        gtk_container_add( GTK_CONTAINER( tally->but ), tally->label );
        gtk_widget_show( tally->label );

        gtk_table_attach( GTK_TABLE( tcol->table ), tally->but,
                 1, 2, tally->row, tally->row + 1,
                 GTK_FILL, GTK_EXPAND | GTK_FILL,
                 0, 0 );

John
--
John Cupitt, john.cupitt@ng-london.org.uk, +44 (0)20 7747 2570
VASARI Lab, The National Gallery, Trafalgar Square, London, WC2N 5DN




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