Re: How to create custom keyboard shortcuts for GTKTreeView?



Hi.

Nonetheless, it feels a bit unnatural to replicate in my code behavior
that's already available in GtkTreeView, just so I can remap the
keys.. but whatever works, I guess (:

Alternatively, you can also emit GtkTreeView::move-cursor signal with
proper arguments, but getting them right is a bit tricky, since no
documentation exists.

Sample code would look something like this:
-----------
gboolean result;
g_signal_emit_by_name( treeview, "move-cursor",
                       GTK_MOVEMENT_DISPLAY_LINES, 1, &result );
-----------
Third parameter is GtkMovementStep, but not all elements of enum are valid in
this context. You should only use:
 1. GTK_MOVEMENT_LOGICAL_POSITIONS -> move horizontally in the selected row
 2. GTK_MOVEMENT_VISUAL_POSITIONS -> same as above (for now at least;)
 3. GTK_MOVEMENT_DISPLAY_LINES -> move up or down lines
 4. GTK_MOVEMENT_PAGES -> move up or down pages
 5. GTK_MOVEMENT_BUFFER_ENDS -> move to beginning or end

Fourth parameter controls direction of movement:
 - for 1 and 2, 1 means move to the right, anything else means move to
the left (rtl languages have this mirrored)
 - for 3, -1 means move up, anything else means move down
 - for 4, this number is used as number of pages to move (-3 means
move three pages up, 2 means move two pages down)
 - for 5, -1 means go to start, anything else means go to end

Note that this is not 100% sure, since I obtained this knowledge using
grep, but I think you should be able to start experimenting.

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]