GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Oct 01, 2014 12:17 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Catching scroll events
PostPosted: Wed Mar 20, 2013 11:41 am 
Offline
Familiar Face

Joined: Tue Oct 23, 2012 8:13 am
Posts: 5
I have (in GTK 2.2, Ubuntu 10.04) a drawing-area widget that needs to react to a number of events, amongst which the mouse wheel. I had expected the latter to cause button-4 & 5 presses and releases, to be delivered in the same way as the other button events (which work like a charm). But no such events arrive, when I operate the mouse wheel.

So I added GDK_SCROLL_MASK to the widget with add_event, and g_signal_connect "scroll-event", just like I added the button presses. But still, no joy. The mouse wheel is completely ignored. In the Xaw version of the code, from which this was ported, I do get the button 4 & 5 events, so I know the hardware is working.

Is there anything else I would have to do to attach a callback to the mouse wheel?

Code:
g_signal_connect (graph, "expose-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);
gtk_widget_add_events(GTK_WIDGET(graph), GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK );
g_signal_connect (graph, "button-press-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);
g_signal_connect (graph, "button-release-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);
g_signal_connect (graph, "scroll-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);
g_signal_connect (graph, "motion-notify-event", G_CALLBACK (GraphEventProc), (gpointer) &option[i]);


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Google Adsense [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group