How to remove item from tree?
- From: "Mee Com" <writemessage hotmail com>
- To: gtk-app-devel-list gnome org
- Subject: How to remove item from tree?
- Date: Sat, 31 Jan 2004 18:00:40 +0000
Hi!
I create a tree and attach on a table like this........
/* Create the root tree */
tree = gtk_tree_new ();
/* Create table */
table = gtk_table_new (8, 8, FALSE);
gtk_container_add (GTK_CONTAINER (hbox9), table);
gtk_widget_show(table);
gtk_table_attach_defaults(GTK_TABLE(table), tree, 0,5, 0, 4);
/* connect all GtkTree:: signals */
/* Create button click for remove item */
button = gtk_button_new_with_label("Remove Item(s)");
gtk_widget_set_sensitive(button, TRUE);
g_signal_connect (button, "clicked",
G_CALLBACK (cb_remove_item),
tree);
gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 5, 6, 8);
gtk_widget_show(button);
tree_buttons->remove_button = button;
and I use the function "cb_remove_item" as show on testgtk.c in
gtk+-2.2.4.zip package like this...
cb_remove_item(GtkWidget*w, GtkTree* tree)
{
GList* selected_list;
GList* clear_list;
selected_list = GTK_TREE_SELECTION_OLD(tree);
clear_list = NULL;
while (selected_list)
{
clear_list = g_list_prepend (clear_list, selected_list->data);
selected_list = selected_list->next;
}
clear_list = g_list_reverse (clear_list);
gtk_tree_remove_items(tree, clear_list);
g_list_free (clear_list);
}
when I click this button,why it still can't remove the member of the tree.
I kept the member of the tree(I mean the item) in an array like this ......
static gchar *onlinenames[] = {"Mee", "John"}
but it still can't remove any of names from the tree when I click this
button.
Thanks for all of your advise!
Regards,
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]