Re: TreeView without a selection when rendered




On Dec 27, 2007, at 10:20 PM, José Alburquerque wrote:

Joaquim Schmidlap wrote:
Whenever I put a TreeView on a window, it appears with the top row selected. I would like it to appear initially with no rows selected, but still allow the user to make selections later.


From my experience using a tree view (not a lot, but maybe enough to point some things out), items are not selected automatically. There are methods, such as "set_cursor()" that do modify the selection, but I don't think that anything is automatically selected even after constructing and adding items to a tree view.

I've tried get_selection()->unselect_all() in both on_realize and on_show, but it doesn't work. I'm guessing whatever does the initial selection happens after those events.


This should not be necessary if you make sure that there are no calls to TreeView methods such as "set_cursor()" or setting the selection somewhere in you're code.

Agreed. I just ran a test application and set breakpoints on all three flavors of TreeView::set_cursor(), but none were entered.

While I was in there, I also set a breakpoint on the selection changed signal. The stack trace is very deep and a bit hard to read, but it looks like when the TreeView grabs focus, way down in gtk there is a call to gtk_tree_view_real_set_cursor(). So it looks like an inherent property of the underlying gtk widget itself. My options now would appear to be to (1) use the kludge I detailed in my other email, or (2) force focus to some other widget.

Thanks for the feedback...

js


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