Re: gtkclist and delete selections



On Tue, Jun 19, 2001 at 03:38:10AM -0500 Jason Yeh wrote:

Hi everyone,

I tried to delete selected entry by the following way, but always ended up deleting entries not in the 
selection and I can't find much reference on dealing with selection variable of gtkclist directly, what did 
I do wrong?  Thanks.

void list_delete ( GtkWidget * item, gpointer list ) {

      gpointer pdata;
  GList * p;

  gtk_clist_freeze ( GTK_CLIST ( list ) );
      p = GTK_CLIST ( list )->selection;

  while (p != NULL) {
              g_assert ( p != NULL );
        pdata = gtk_clist_get_row_data ( GTK_CLIST ( list ), (gint) p->data );
    gtk_clist_remove ( GTK_CLIST ( list ), GPOINTER_TO_UINT ( p->data ) );
              p = p->next;

      }

      gtk_clist_thaw ( GTK_CLIST ( list ) );

}

You have to assign p = p->next; before calling gtk_clist_remove(), because
this function removes p from clist->selection.

Markus.




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