Scrolling a Tree View before it's realized



Hi

In an application i add many items to a ListStore and make it scroll on the fly to the default option row, like this

for (i = 0; i < NUMBER_OF_ITEMS; i++) {
    gtk_list_store_append (store, &iter);
    gtk_list_store_set (store, &iter, MY_COLUMN, mystrings[i], -1);
    if (default_option_index == i) {
        path = gtk_tree_model_get_path(model, &iter);
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(view), path, NULL, FALSE, 0.5, 0);
        gtk_tree_view_set_cursor (GTK_TREE_VIEW(view), path, NULL, FALSE);
        gtk_tree_path_free (path);
    }
}

Later i pack the TreeView into proper box hierarchy and eventually show the gtkwindow and within contained widgets.

Now, scrolling works inconsistently, as the row gets indeed selected but the scrolling is only "partial". I wonder if this is because i'm attempting to scroll to a row in a treeview which has not been realized yet. In the case, does performing scroll after widget realization, from within a proper callback, will solve this issue?

thanks

Attilio



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