ScrolledWindow - how to enable scrolling with page up and page down keys?

Hi,

I have a Scrolled Window. The mouse keys work fine, I can scroll up and
down, but not with page up and page down.

Does someone understand why page up and page down does not work or more
importantly how to enable this?

scrolled_window = Gtk::ScrolledWindow.new
scrolled_window.add_with_viewport(text_view)

When I am with my cursor inside such a scrolled window, the page up and
page down keys don’t seem to make anything.

You could try the key_press event or button_release_event. Look in the
docs. Add this line inside the method:

puts "Key number: " + key.to_s

When the program runs, press the pageup key and look at the number.

Then write in your code:

if key == (number)

end

Hope this helps.

If you’re using visualruby, you could just add the method:

scrolledwindow1_key_press(me, key)
if key.keyval == 65365 #PgUp

else if key.keyval == 65366 #PgDn

end
end

Give that a shot.

Eric

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs