RE: Finding which row is selected in a CList
- From: martyn 2 russell bt com
- To: ridefast ozemail com au, gtk-app-devel-list gnome org
- Subject: RE: Finding which row is selected in a CList
- Date: Thu, 23 May 2002 10:52:13 +0100
The two most common ways of doing it are:
1, (Jean-Christophe Berthon's Code submitted earlier this week)
gint SelectedRowRank;
for (i = 0; i < g_list_length((GTK_CLIST(myCList))->selection); i++)
{
/* This is to get the row rank (or index) in the Clist */
SelectedRowRank =
GPOINTER_TO_INT(g_list_nth_data((GTK_CLIST(myCList))->selection, i));
/* Now you can use it to access the text field, or whatever you'd like */
gtk_clist_get_text(GTK_CLIST(myCList), SelectedRowRank, Column,
&pcTextField);
g_print("Field = %s", pcTextField);
}
OR
2, (the way I sometimes do it)
gint index = -1;
gint count = GTK_CLIST(myclist)->rows;
GList *list = NULL;
for(index=0;index<count;index++)
{
list = g_list_nth(GTK_CLIST(myclist)->row_list, index);
if(GTK_CLIST_ROW(list)->state == GTK_STATE_SELECTED)
{
...
}
}
Regards,
Martyn
-----Original Message-----
From: Jayson Hay [mailto:ridefast ozemail com au]
Sent: Thursday, May 23, 2002 8:25 AM
To: gtk-app-devel-list gnome org
Subject: Finding which row is selected in a CList
Hi All,
I have a button that, when clicked should get a number from a cell in
the selected row of a clist. I have passed the clist to the function as
user_data and I am using the following to get the text I need:
gtk_clist_get_text (user_data, NULL, 0, &message);
What I want to do is change NULL to the number of the currently selected
row in the clist. Is there a way to do this? I have the gtk docs and
cant find what I'm looking for there.
jay
----------------------------
ii swear I never use vi^[:wq
----------------------------
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]