Jon Nelson wrote:
>On Tue, 19 Mar 2002 09:40:54 +0800
>"James Henstridge" <[EMAIL PROTECTED]> wrote:
>
>>You can use the plus and minus keys to expand and collapse the selected
>>node in the ctree.
>>
>
>Cool! In the meantime, I grabbed the key_press_event signal for the ctree,
>and checked for GDK.{Left,Right}. If it was one of those, I did an
>"emit_stop_by_name" on key_press_event, and then performed a little
>magic to expand/collapse the current focus row.
>
>Would it be better to avoid the magic and try to emit a +/- keypress?
>
I think you can set this up in a gtkrc file for your application. As
GtkCTree uses the GTK Bindings API, you should be able to load a file
holding something like:
binding "my-ctree-bindings" {
bind "right" {
"change_focus_row_expansion" (expand)
}
bind "left" {
"change_focus_row_expansion" (collapse)
}
}
widget "widgetname" binding "my-ctree-bindings"
Load the gtkrc file with gtk.rc_parse(), then call set_name() on your
CTree so that the above binding affects it. If you want the left/right
bindings above for all CTrees in all apps, put the above in your
~/.gtkrc file, with the following line:
class "GtkCTree" binding "my-ctree-bindings"
(I may have gotten the syntax slightly off, as I didn't test this
specific case. Have a play around with it until it works).
In gtk 2.0, many more widgets can have their key bindings customised
like this.
James.
--
Email: [EMAIL PROTECTED]
WWW: http://www.daa.com.au/~james/
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/