How to create custom keyboard shortcuts for GTKTreeView?
- From: Jez <jezreel gmail com>
- To: gtk-app-devel-list gnome org
- Subject: How to create custom keyboard shortcuts for GTKTreeView?
- Date: Sat, 17 Apr 2010 17:08:30 +0000
I would like the user to be able to scroll up and down the treeview,
expand/close rows etc with the keyboard. This is already possible with
the arrow keys; however, I would like to use different ones.
I'm pretty new to Gtk programming so I might be missing out something
here, but this is my problem:
As far as I can tell, the best way to change the selected row is
void gtk_tree_view_set_cursor (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *focus_column,
gboolean start_editing);
However, the problem arises when I try to manipulate the GtkTreePath.
Functions like gtk_tree_path_next and gtk_tree_model_iter_next move
the path to point to the next node at the *current* depth. If the node
is the last one at depth n, it doesn't automatically jump to the next
node at depth n-1. So basically to get this to work properly I need to
go through a number of contortions to find out of the node is the last
one (or the first one) for its depth, and I have to track the expanded
/ collapsed state of each node in the tree (because gtk doesn't seem
to provide an API to check whether a row is expanded -- it just emits
signals when the expansion occurs.)
Is there a better way to do this?
Regards,
Jez
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]