Re: [gtk-list] How to change a label in a GtkTree?




On Fri, 9 Jul 1999, Quentin Delamarre wrote:
> 
> I've got the GtkTreeItem corresponding, created by the function:
> item = gtk_tree_item_new_with_label("Label 2");
> 
> And my question is:
> 
> how to change the text of the label from the item ?
> 

Do gtk_tree_item_new_with_label() by hand, that is, cut-and-paste its
implementation:

 GtkWidget*
 gtk_tree_item_new_with_label (gchar *label)
 {
  GtkWidget *tree_item;
  GtkWidget *label_widget;

  tree_item = gtk_tree_item_new ();
  label_widget = gtk_label_new (label);
  gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);

  gtk_container_add (GTK_CONTAINER (tree_item), label_widget);
  gtk_widget_show (label_widget);


  return tree_item;
}

Then you'll have a pointer to the label widget and you can
gtk_label_set_text().

You could also call gtk_container_children() on the tree item and the
label should be the tree item's only child.

Havoc




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