Events and Scrolling

Hi,

In Gtk::ComboBoxEntry you can scroll down and scroll up.

I want to tie this to a Gtk::Entry and whenever a
user scrolls up or down, i want to trigger a specific
action in another widget - however, using this:

.signal_connect(‘event’) do |widget, event|
if event.event_type.name == ‘GDK_SCROLL’

gives me only access to a scroll event (yes/no)

I do not know how to specifically check for scrolling up or
scrolling down, only for general scrolling event.

Does someone know how to check the direction of the
mouse wheel scrolling, as like Gtk::ComboBoxEntry is
doing it too?

Thanks for any helpful pointers

=


Powered by Outblaze


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

On Tue, May 08, 2007 at 11:32:08PM +0100, Roebe XXX wrote:

I do not know how to specifically check for scrolling up or
scrolling down, only for general scrolling event.

You want to access the event.direction property to do this:

e = Gtk::Entry.new
e.signal_connect(“event”) do |w, e|
if e.event_type.name == ‘GDK_SCROLL’
case e.direction
when Gdk::EventScroll::Direction::DOWN
puts “scrolled down!”
when Gdk::EventScroll::Direction::UP
puts “scrolled up!”
end
end
end

hope that helps.

-pete


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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