Re: GtkList
- From: Mike <maddoc en com>
- To: Stephane Duguay <sduguay Matrox COM>, gtk-app-devel-list gnome org
- Subject: Re: GtkList
- Date: Tue, 27 Feb 2001 19:34:52 -0500
On Tuesday 27 February 2001 14:42, Stephane Duguay wrote:
Hi,
I've been looking in the GtkList doc but cannot get my answer.
It looks to me that there's no clean way to get which items are selected
in a list when it's time to check for that (when user press the "Ok"
button).
I think it's a bit crappy to catch all the signals for every
selection/unselection for each item and modifying a global struct all the
time until he click the OK button to then use this structure.
Anyone got an idea to get the list state at a precise moment ?
Yes, as far as I know there is no clean way to get the items selected. Here
is what I'm doing:
GList *selected;
selected = GTK_CLIST(receiver_clist)->selection;
while (selected != NULL)
{
gtk_clist_get_text(GTK_CLIST(clist), GPOINTER_TO_INT(selected->data), 0,
&data);
/* do whatever you need to with data */
selected = selected->next;
}
Sorry, my example is for a CList but the idea is the same for a list, you
just cycle through the linked list grabbing the data until you hit NULL.
Use at your own risk I suppose since you are messing around with an internal
data structure, but it's the only sane way I have found to do it.
Mike
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]