Re: GtkListStore. (Multiple selection)



Il mar, 2002-10-15 alle 03:34, Harring Figueiredo ha scritto:


 Folks,

 I have posted this before and got no answers. I am posting again :)

 I have a GtkListStore and would like to activate/deactive a button on the
toolbar if there is something select on the list. i.e: If any row(s) is
selected the "Delete Selected" button is active, else the button is innactive.

 I have set up the GtkSelection to MULTIPLE. It seems that listening for the
"changed" signal does not give me enough infrmation. (Even the doc says that
the "changed" signal is just a hint.

  Has anyone implemented this type of behaviour on the GtkListStore.

 I have looked into all the Demos/example/docs and could not find anything
pointing to it. I even looked at some code fot the Selection and Gtkstore.

  Please, help.

Harring.

Hi,

Are you using Gtk2? if yes this is my way!


GtkWidget *lista;
GtkTreeSelection *select;

select = gtk_tree_view_get_selection (GTK_TREE_VIEW (lista));
gtk_tree_selection_set_mode (select, GTK_SELECTION_MULTIPLE);
g_signal_connect (G_OBJECT (select),"changed",
                  G_CALLBACK(select_change), NULL);


Then the callback function:

static void select_change(GtkTreeSelection *selection, gpointer data){
        //Use the GtkTreeSelection object to retrive the information you
        //need
}       


Hope you find my example useful...
dave gurumeditation it








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