Re: [gtk-list] newbie g_list_remove prob



> I have been trying to use the g_list_remove() function and am not being
> successful.
>
> I have created a glist called Toys.  I can use this glist in a combo box
to
> select the toys and it works find.  Now I want to remove one toy from the
> list.  Using gtk_entry_get_text() on the combo box I get the currently
> selected toy.  I then use this as the second argument to g_list_remove (
> g_list_remove(Toys, selectedToy) ).  But if I read through the glist right
> after the remove the selected Toy is still in the list.  What am I doing
> wrong?

The only thing I can think of, is that the pointer that gtk_entry_get_text
returns to the text isn't the same as the pointer that is stored in the
list.
It might be possible to loop through the list comparing doing strcmp
(Toys->data, selectedToy) on it, and then deleting the one that matches,
although this seems a long winded (and potentially very time consuming) way
of doing it.

Iain



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