Re: disabling mouse scroll on GtkComboBox and spin buttons



On 22 May 2016 at 07:36, Lokesh Chakka <lvenkatakumarchakka gmail com> wrote:
Is there a way to disable mouse scroll on GtkComboBox and GtkSpinButton
widgets ?

Yes, the mouse wheel to change the combo drives me CRAZY.

It means you can't use the mouse wheel to scroll a window that
contains widgets, since you might scroll a combo under the pointer
accidentally, and then you start changing the combo value instead of
scrolling. And once you've changed it, you can't change it back,
because you've no idea what it was set to before.

I block this in my code by connecting to scroll-event on the combo, for example:

x = gtk_combo_box_new_text();
g_signal_connect(x, "scroll-event", G_CALLBACK(true_cb), NULL);
...

where

static gboolean
true_cb(GtkWidget *wid, GdkEvent *event, void *data)
{
        /* Stop any other scroll handlers running. We don't want the scroll
         * wheel to accidentally change widgets while we're moving.
         */
        return TRUE;
}

John


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]