Re: [gtk-list] Re: newbie g_list_remove prob
- From: "Timothy I. McGinnis" <tmcginnis synertechsystems com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: newbie g_list_remove prob
- Date: Thu, 5 Aug 1999 09:18:12 -0500
>> 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
Does g_list_remove() compare the pointer or the string which the pointer
points to when searching for the appropriate entry? In other words, do I
need to pass in the original
variable which I used in the g_list_append() to create the list? (That
didn't sound to clear either)
Tim M.
"Iain" <nodatadj@webtribe.net> on 08/05/99 08:05:26 AM
Please respond to gtk-list@redhat.com
To: gtk-list@redhat.com
cc:
bcc:
Subject: [gtk-list] Re: 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
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]