Re: GtkListStore wit multiple selection.



 Martyn,

 Thanks for the reply.

 Yes, I am using a GtkTreeModel.

 The fuction to listen for the "changed" signal is:

static void
selection_changed (GtkTreeSelection *selection)
{
    ...
    if (gtk_tree_selection_get_selected (selection, &model, &iter))
    {
     ... This fails because of the code assertion (see [1] below)
    }
...
}

  In this case, I cannot use the "changed" signal to listen for
selected/unselected on a GtkSelectionMode MULTIPLE.

  The only other way is to interate through all the nodes/rows and see if they
are selected -- quite expensive.)





[1]
From: gtktreeselection.c

line 360   g_return_val_if_fail (selection->type != GTK_SELECTION_MULTIPLE,
FALSE);






--- Martyn Russell <ginxd btopenworld com> wrote:
On Wed, 2002-10-09 at 19:21, Harring Figueiredo wrote:


 Hello all,


 I have a liststore with MULTIPLE selection. Is there a way to find out if
the
rows are selected ?

 Here is what I am trying to do:

  If any rows are selected , activate Del Button.
  else, inactivate Del button.

 The problem is that the "changed" signal is only a hint to the selection.
If
the row is selected and the user unselects it, the signal is also emitted.
(The
documentation describes this.). Keep in mind that my selection mode is
MULTIPLE.


I know this sounds strange, but have you looked at GtkTreeSelection??
http://developer.gnome.org/doc/API/2.0/gtk/gtktreeselection.html

It may work, after all, Im sure you have to use GtkTreeModel for a
GtkListStore.


  Thanks in advance for any help.

Harring.

__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Regards,

Martyn



__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com



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