Hi,

On Fri, 18 Nov 2005 02:42:18 +0900
ces.fci.junk / gmail.com wrote:

> I've something similar to that already.. but.. let me try to rephrase.
> here is what I have so far:
> tree.signal_connect("key-press-event") do |widget, event|
>     if Gdk::Window::ModifierType::CONTROL_MASK == event.state &
> Gdk::Window::CONTROL_MASK
>         case event.keyval
>             when 117 then # ctrl-u
>                 # scroll my widget up
>             when 100 then # ctrl-d
>                 # scroll my widget down
>         end
>     end
> end

How about the sample below?

-----
require 'gtk2'
Gtk.init
model = Gtk::ListStore.new(String)
tv = Gtk::TreeView.new(model)
tv.append_column(Gtk::TreeViewColumn.new("TITLE", 
					 Gtk::CellRendererText.new,
					 :text => 0))
tv.enable_search = false
model.append[0] = "LINE 1"
model.append[0] = "LINE 2"
model.append[0] = "LINE 3"

tv.signal_connect("key-press-event") do |widget, event|
  if Gdk::Window::ModifierType::CONTROL_MASK == event.state &
      Gdk::Window::CONTROL_MASK
    case event.keyval
    when Gdk::Keyval::GDK_u # ctrl-u
      tv.move_cursor(Gtk::MOVEMENT_DISPLAY_LINES, -1)
      tv.selection.select_path(tv.cursor[0])
    when Gdk::Keyval::GDK_d # ctrl-d
      tv.move_cursor(Gtk::MOVEMENT_DISPLAY_LINES, 1)
      tv.selection.select_path(tv.cursor[0])
    end
  end
end

Gtk::Window.new.add(tv).show_all

Gtk.main
-----

--
.:% Masao Mutoh<mutoh / highway.ne.jp>