I sent a post about this in January. My solution retains the scrolling
feature but disables it when scrolling the parent window. 

Note that each combobox is inside an event box and
hence the gtk_bin_get_child in combobox_scroll_fix.

static gboolean _block_scroll = TRUE;

static void
combobox_no_scroll(GtkWidget *combo, gpointer data){
    if(_block_scroll) g_signal_stop_emission_by_name(combo, "scroll-event");
}

static void
combobox_focus_in(GtkWidget *combo, gpointer data){
    _block_scroll = TRUE;
}

static void
combobox_motion_notify(GtkWidget *combo, gpointer data){
    _block_scroll = FALSE;
}

static void
combobox_scroll_fix(GtkWidget *w){
    g_signal_connect(w, "enter-notify-event",  G_CALLBACK(combobox_focus_in),   
   NULL);
    g_signal_connect(w, "motion-notify-event", 
G_CALLBACK(combobox_motion_notify), NULL);
    g_signal_connect(gtk_bin_get_child(GTK_BIN(w)), "scroll-event", 
G_CALLBACK(combobox_no_scroll), NULL);
}


On Sun, 2016-05-22 at 23:38 +0530, Lokesh Chakka wrote:
> thanks guys....
> 
> I am using like this:
> 
> g_signal_connect( spin_button, "scroll-event", G_CALLBACK(gtk_true), NULL );
> g_signal_connect( combo_box, "scroll-event", G_CALLBACK(gtk_true), NULL );
> 
> issue resolved......
> 
> Thanks & Regards
> --
> Lokesh Chakka,
> Mobile: 9731023458
> 
> On Sun, May 22, 2016 at 8:48 PM, Ben Iofel <iofel...@gmail.com> wrote:
> 
> > There's a utility function for just returning true: gtk_true
> >
> > On Sun, May 22, 2016, 6:53 AM <jcup...@gmail.com> wrote:
> >
> > > On 22 May 2016 at 10:57, Florian Pelz <pelzflor...@pelzflorian.de>
> > wrote:
> > > > On 05/22/2016 11:54 AM, jcup...@gmail.com wrote:
> > > >> x = gtk_combo_box_new_text();
> > > >> g_signal_connect(x, "scroll-event", G_CALLBACK(true_cb), NULL);
> > > >> ...
> > > >
> > > > Ah yes, this is a much better way.
> > >
> > > I'm not sure it'd work for spin buttons though :-(
> > >
> > > Something like your event masks, Florian, would probably be necessary for
> > > that.
> > >
> > > John
> > > _______________________________________________
> > > gtk-app-devel-list mailing list
> > > gtk-app-devel-list@gnome.org
> > > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> > >
> > _______________________________________________
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list@gnome.org
> > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> >
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to