Re: GtkListStore. (Multiple selection)



It's difficult for me to explain in english so I try with C
The file multiple.c make what you need (I think).
I have activate the button when 2 or more rows are selected because 
I don't know how to deselect the last element;
and there are some problem with the row removing, but I hope you can use
it.

By

Dave
dave gurumeditaion it


Il mar, 2002-10-15 alle 16:56, Harring Figueiredo ha scritto:


  Dave,

 Thanks for the reply. I am affraid I have tried that and it does not work as I
expected.

 From the Docs:
"gtk_tree_selection_get_selected () [ Removed some parts ]
Sets iter to the currently selected node if selection is set to
GTK_SELECTION_SINGLE or GTK_SELECTION_BROWSE. iter may be NULL if you just
want to test if selection has any selected nodes. model is filled with the
current model as a convenience. This function will not work if you use
selection is GTK_SELECTION_MULTIPLE.


 Also, I can not call the foreach method as I need to remove the selected
nodes.

 Thanks for the replay -- any other suggestion ?

Harring.




--- dave <dave gurumeditation it> wrote:
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







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


Attachment: multiple.c
Description: Text Data



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