GtkTable and allignment
- From: anonymous user <useanonymous gmail com>
- To: gtk-app-devel-list gnome org
- Subject: GtkTable and allignment
- Date: Wed, 1 Jun 2005 03:04:51 -0700
Hi all.
I just started playing around with gtk+ and I've run into a very
frusterating problem. I'm hoping someone can help me out.
All I need is a simple table with X rows and 2 column's. both left
and right column hold text only and alligned to the left.
I can't seem to get them alligned correctly. No matter what I try,
the text gets centered.
Here's some code to illustrate the technique I'm trying. The issue doesn't show
up here, but I use the same technique on tables with more rows and labels with
different numbers of characters in them.
GtkWidget * get_eident_label()
{
static GtkWidget * eident_label;
if(eident_label){
return eident_label;
}
eident_label = gtk_label_new( "" );
gtk_misc_set_alignment(GTK_MISC(eident_label) , 0.0f , 0.0f );
return eident_label;
}
GtkWidget * get_ehdr_table()
{
static GtkWidget * table;
GtkWidget * tmpw;
if(table)
return table;
table = gtk_table_new( 1 , 2 , FALSE );
tmpw = gtk_label_new("e_ident:");
gtk_misc_set_alignment(GTK_MISC(tmpw) , 0.0f , 0.0f );
gtk_table_attach( GTK_TABLE(table ) , tmpw , 0 , 1 , 0 , 1 ,
GTK_SHRINK , GTK_SHRINK , 0 , 0 );
tmpw = get_eident_label();
gtk_table_attach( GTK_TABLE(table ) , tmpw , 1 , 2 , 0 , 1 ,
GTK_SHRINK , GTK_SHRINK , 0 , 0 );
return table;
}
char * get_eident_str( elf_t * elf )
{
/* XXX test stub XXX */
return "E L F";
}
static void ehdr_view_set_data( GtkWidget * w , gpointer data )
{
GtkWidget * tmpw;
elf_t * elf;
elf = ELFWIDGET(w)->elf;
if( elf )
{
char * tmpstr;
tmpstr = get_eident_str( elf );
tmpw = get_eident_label();
gtk_label_set_text( GTK_LABEL(tmpw) , tmpstr );
}
}
So this is the current state of things. I've been hacking around for
hours trying different stuff, but I can't get what I want ( which I
really doubt is impossible ).
Any suggestions would be appreciated.
anon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]