gtk_tree_selection_select_iter after gtk_tree_store_append not working



Hi,

While coding on Glade for my GSoC project, I'd like to select a specific row in a tree view (backed by a hierarchical GtkTreeStore) while building it up. For this I am doing something like the following in a loop:
  gtk_tree_store_append (model, &iter, ...);
  gtk_tree_model_set (model, &iter, ....);
  if (is row to select)
    gtk_tree_select_iter (selection, &iter);

However, this doesn't work. Removing the "if" conditional and printing out gtk_tree_selection_get_selected (selection, NULL, NULL) right after select_iter reveals that only the root element can be selected this way (printout is 1), while all others don't get selected (printout 0).
Digging a bit deeper, it seems that _gtk_tree_view_find_node(), called 
from gtk_tree_selection_select_path(), cannot find an RBNode belonging 
to the tree iter's path (it returns TRUE, which makes the next statement 
silently return). This is very strange, though, considering that I added 
that exact row which the iter points to two statements earlier.
How can this be? I am really stuck with this and need your help! Thanks 
in advance.
(Oh, and the tree view is not yet added to a parent widget or shown on 
the sreen during the model buildup, if that matters; the model is, 
however, set as model of the tree view.)
Regards,
Denis Washington



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