[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: problems with table and labels
- From: Theodore Roth <troth netmagic net>
- To: gtk-app-devel-list redhat com
- Subject: Re: problems with table and labels
- Date: Thu, 26 Aug 1999 22:07:56 -0700
Theodore Roth wrote:
>
> J.Blunck@tu-harburg.de wrote:
> >
> > I want to add 2 labels and 2 entries to a table. The problem is that
> > the labels are not left aligned. How can I do that ?
> >
>
> Put the labels in an alignment widget and then attach the alignment to
> the table. Here's an example:
>
I was just digging through some gtk source and found a better way to do
this:
GtkWidget *add_label_to_table( GtkWidget *table, gint left, gint top,
gchar *str )
{
GtkWidget *label;
label = gtk_label_new( str );
gtk_misc_set_padding( GTK_MISC( label ), 5, 0);
gtk_misc_set_alignment( GTK_MISC( label ), 1.0, 0.5 );
gtk_widget_show( GTK_WIDGET(label) );
gtk_table_attach_defaults( GTK_TABLE(table), label, left, left+1, top,
top+1 );
return label;
}
This is probably the preferred way. This is still for right alignment.
For left alignment, use
gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
As a bonus, the 0.5 vertically aligns the label text up with the text in
the entry widget to the right so it looks correct.
Ted Roth
--
Email: <troth@netmagic.net> Web site: <http://www.netmagic.net/~troth>
------------------------------------------------------------------------
"Of all the things I miss from veterinary practice, puppy breath
is one of the most fond memories!"
--- Dr. Tom Cat
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]