Re: Deleting selected items from a list



I think it's because you are forgetting that selection only
grabs the first one...you have to keep iterating through the
list to get them all. Try something like this:

GList *sel = GTK_CLIST(list)->selection;

while(sel)
{
gtk_clist_remove(GTK_CLIST(list), (int)sel->data);
sel = GTK_CLIST(list)->selection;
}

Hope that helps!

Fethiye Akbulut wrote:

Hi all,

I have a list which I am able to delete all its entries by just calling

GtkList *liste;
GList   *to_delete = GTK_LIST(liste)->children;
gtk_list_remove_items(liste, to_delete);

Well, the problem occurs when I am trying to delete the selected ones
using a similar code to above:

GtkList *liste;
GList   *to_delete = GTK_LIST(liste)->selection;
gtk_list_remove_items(liste, to_delete);

What am I missing?

The messages I am getting are:

Gtk-CRITICAL **: file gtkwidget.c: line 1247 (gtk_widget_unparent):
assertion `widget != NULL' failed.

Gtk-CRITICAL **: file gtksignal.c: line 981
(gtk_signal_disconnect_by_data): assertion `object != NULL' failed.

Thanks in advance,
Fethiye
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.


_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list


--
Jeff "Shippy" Shipman     E-Mail: shippy cs nmt edu
CS Major / EE Minor       ICQ: 1786493
New Mexico Institute of Mining and Technology
Homepage: http://www.nmt.edu/~shippy





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