=?iso-8859-1?Q?RE=3A_Selecting_item_with_another_b=E9haviour?=
- From: martyn 2 russell bt com
- To: edipreto skynet be, gtk-app-devel-list gnome org
- Subject: RE: Selecting item with another béhaviour
- Date: Fri, 21 Feb 2003 10:02:11 -0000
Sorry for the break
in the thread, but I didn't write this mail on my linuxbox.
What I want to
do with my GtkListStore is not configure it to be able to select more than one
item. I've already post or read a mail about that. What I want to do is to
modify the behaviour to select another item in my GtkListStore.
So by this you mean, you want to
select ONLY 1 at a time? If so, just set the selection to
SINGLE.
selection =
gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection),
GTK_SELECTION_SINGLE);
So, I must connect my own
function on my GtkTreeView. And this function contain the following algorithm
:
on_click(item) {
if (is_selected(item) ==
TRUE)
{
set_selected(item, FALSE);
}
else
{
set_selected(item,
TRUE);
}
}
The problem is that I don't know the name of
the event, and I don't know how to change the state of an item (selected or
not selected).
For
the selection change, you want to look at the "changed" event for the
selection.
/* set changed event function
*/
g_signal_connect(G_OBJECT(GTK_TREE_SELECTION(selection)), "changed",
G_CALLBACK(on_treeview_ops_selection_changed),
NULL);
The
function in G_CALLBACK() should look something like this:
void
on_treeview_ops_selection_changed(GtkTreeSelection *treeselection, gpointer
user_data)
{
...
}
Regards,
Martyn
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]