[Glade-users] GtkTreeView - row select event?
- From: john jcoppens com (John Coppens)
- Subject: [Glade-users] GtkTreeView - row select event?
- Date: Sat, 9 Aug 2003 13:11:49 -0300
On Fri, 08 Aug 2003 11:34:25 +0200
R=E9mi Cohen-Scali <Remi Cohen-Scali com> wrote:
Yes you can then test if there's a selection with 'get_selected'.
Another way exists by registering a select func.
here is an example of code (from gpdf):
I did a much more simpler thing, maybe this will frighten people who read
this less (the requirement is that only one item gets selected, of
course):
void
on_card_view_cursor_changed (GtkTreeView *treeview,
gpointer user_data)
{
GtkTreeModel *tstore;
GtkTreeSelection *tsel;
GtkTreeIter iter;
GValue value;
memset (&value, 0, sizeof (value));
tsel =3D gtk_tree_view_get_selection(treeview);
if (gtk_tree_selection_get_selected(tsel, &tstore, &iter)) {
gtk_tree_model_get_value(tstore, &iter, 1, &value);
do_something_with_this(g_value_get_uint(&value));
}
}
Note: I have two values in each iter: A name, and a number which I use to
look up records in a database. I pass the number to the
'do_something_with_this' function to show the record on a form.
Hope this helps someone...
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]