list model not aligned

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

 



Hi,

I made a List store model with 2 columns:

/* start here */

enum
{
  NUMBER_ITEM = 0,
  ITEM,
  NUM_COLS
} ;


  scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (scrolledwindow);
  gtk_box_pack_start (GTK_BOX (hbox2), scrolledwindow, TRUE, TRUE, 0);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

  view = gtk_tree_view_new();
  list = gtk_list_store_new(NUM_COLS, G_TYPE_INT, G_TYPE_STRING);
  
  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolledwindow),
view);
  gtk_tree_view_set_model (GTK_TREE_VIEW (view), GTK_TREE_MODEL (list));
			   
  cell = gtk_cell_renderer_text_new ();
  gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, "#",
cell, "text", NUMBER_ITEM, NULL);
  
  cell = gtk_cell_renderer_text_new ();
  gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, "ITEM",
cell, "text", ITEM, NULL);
  
  gtk_widget_show (view);

/* end here */

When I press a button, automatically 2 values fill 2 columns cells:

gtk_list_store_set (list, &iter, NUMBER_ITEM, counter, ITEM, names, -1);
gtk_list_store_append (GTK_LIST_STORE (list), &iter);

'counter' is a gint value and 'names' a gchar* 

values are printed in list but i got:
1
      john 
2
      carl
etc...

number and name are not aligned!
Why?  Can anybody help me?

thanks in advance
France

__________________________________________________________________
Tiscali ADSL SENZA CANONE:
Attivazione GRATIS, contributo adesione GRATIS, modem GRATIS,
50 ore di navigazione GRATIS.  ABBONARTI TI COSTA SOLO UN CLICK!
http://point.tiscali.it/adsl/index.shtml



_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux