Problem with GtkTreeSelection
- From: Bob Caryl <bob fis-cal com>
- To: gtk-list gnome org
- Subject: Problem with GtkTreeSelection
- Date: Tue, 21 Dec 2004 10:03:23 -0600
Greetings everyone,
I am new to this list, to Linux, and to Gtk programming. I am a Windows
(ptooie!) programmer and I have been tasked with migrating a major piece of
software that uses a character graphics user interface to a GUI on Linux.
The good news is that the character based version already runs on Linux.
So, I'm climbing up that nice steep learning curve and I have a problem
(actually, I have a host of problems, but this one is currently the most
pressing): I cannot programmatically select a row in a GtkTreeView (a simple
list box analogy w/o children) using the gtk_tree_selection_select_path
function. I have done the following to try to use this function:
GtkTReeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
gtk_tree_selection_set_mode(sel,GTK_SELECTION_SINGLE);
GtkTreePath *path = gtk_tree_path_new_first ();
gtk_tree_view_expand_row(GTK_TREE_VIEW(tree), path,FALSE);
gtk_tree_selection_unselect_all(sel);
gtk_tree_selection_select_path (sel, path);
gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree), path, NULL, FALSE);
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(tree),path,NULL,FALSE,0,0);
gtk_tree_path_free (path);
The tree view model is a GtkListStore, and it has been populated with dummy
data consisting of 1000 rows, each having only two columns. I can (with the
mouse) readily select any one of the rows in the view, but I need to be able
to programmitically select a row in response to data input by the user in a
GtkEntry edit box. The code I have written to do this finds the appropriate
row, and it scrolls the list to make it visible.. it simply will not select
it.
Any advice would be very much apprieciated.
Best regards,
Bob Caryl
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]