gtk_tree_view_scroll_to_cell does not work ?
- From: "Miroslav Rajcic" <rajcic sokrates hr>
- To: <gtk-app-devel-list gnome org>
- Subject: gtk_tree_view_scroll_to_cell does not work ?
- Date: Fri, 12 Dec 2008 12:19:16 +0100
I am having a method that selects an tree view item and ensures that the
item is visible.
To ensure the visiblity, I am using the gtk_tree_view_scroll_to_cell method.
I've noticed that this method does not seem to work always. When the tree
view is populated so much that it needs to be scrolled in order to make cell
visible, gtk_tree_view_scroll_to_cell will frequently fail to do so!
If someone is interested to test this, you can do with my Notecase project
(http://notecase.sf.net)
Steps to reproduce:
1. Start notecase and load the "help.ncd" document
2. Use "Tree/Expand All" menu item to make sure that the tree view takes
more space than available (scroll bar appears)
3. Select last item in the tree view
4. Now press "Insert" key to insert the new node after the selected note
Note that the step 4 should cause the new note to be visible within the tree
view, but it is not often the case and the tree view is not scrolled to show
the new note.
Sometimes, 1st try seems to work correctly, but any other subsequent try
(adding more and more notes with "Ins" key press) does not work!
Mostly it doesn't work right from the start.
You can find the example code within the Notecase code at "callbacks.cpp".
void on_menu_insert_node - method that inserts new node
void SelectNodeByIdx - method that performs actual selection and scrolling
Note that I've tried replacing the gtk_tree_view_scroll_to_cell with the
following code, but that doesn't work too:
GdkRectangle rect;
gtk_tree_view_get_cell_area(treeview, path2, NULL, &rect);
gtk_tree_view_scroll_to_point(treeview, -1, rect.y);
I've tested and can confirm this behaviour both on Linux (Ubuntu 8.10 i386)
and Windows (latest GTK 2.14.5 from www.gtk.org).
Does anyone have any constructive tip or workaround ?
Can anyone confirm the problem ?
This seems like a major problem to me, because GtkTreeView is one of the
basic components.
TIA,
Miroslav Rajcic
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]