Re: How to create custom keyboard shortcuts for GTKTreeView?



Hello.

Actually, things are not as contorted as you depicted here. For
example, if you would hit the last node at path 2:3:2 (3rd root
element, 4th element on level 1 and 3rd element on level 2),
gtk_tree_model_iter_next() will return FALSE, which means that you
need to get one level up. Getting one level up is as simple as calling
gtk_tree_model_iter_parent() (this will give you node at path 2:3) and
getting next iter on second level is again simple call to
gtk_tree_model_iter_next() (and you get to the path 2:4).

Should move to path 2:4:1 or to 2:5 on next move? It depends on what
gtk_tree_view_row_expanded() function returns. (BTW, is this the API
call you were missing?) In any case, things are again accomplished by
simple call to gtk_tree_model_iter_children() for move to 2:4:1 or
gtk_tree_model_iter_next() for move to 2:5.

This mechanism can be implemented wit just a few simple if clauses in
code that handles movement. You'll need to do some GtkTreeIter <->
GtkTreePath conversions in order to get everything working, but apart
from that, things should be relatively easy.

Tadej

-- 
Tadej BorovÅak
tadeboro.blogspot.com
tadeboro gmail com
tadej borovsak gmail com



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