Re: GtkCList: is row selected?



On Friday 03 December 2004 01:47, Neil Zanella wrote:

> I would like to know whether there is a way to programmatically determine
> whether a particular row is selected in a columned list. 

 GList *l;

 for (l = GTK_CLIST (clist)->selection;  l;  l = l->next)
 {
    gint rownum = GPOINTER_TO_INT (l->data);
    g_print ("Row %d is selected.\n", rownum);
 }

gboolean
clist_is_row_selected (GtkCList *clist, gint rownum)
{
  g_return_val_if_fail (GTK_IS_CLIST (clist), FALSE);
  g_return_val_if_fail (rownum >= 0, FALSE);
  return (g_list_find (clist->selection, GINT_TO_POINTER (rownum)) != NULL);
}

> How come there is no such method to do this?

Probably because people usually want to know which rows are selected, and not 
whether a particular row is selected or not, and because it's basically a 
one-liner, and because at some point people started working on a far superior 
replacement for GtkCList </wild guess>

Cheers
 -Tim

PS: http://mail.gnome.org/archives/  works again these days ;-)



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