Re: Connecting to Gtk::SpinButton::signal_scroll_event()?
- From: Jonathon Jongsma <jonathon quotidian org>
- To: gtkmm-list gnome org
- Subject: Re: Connecting to Gtk::SpinButton::signal_scroll_event()?
- Date: Thu, 20 Dec 2007 06:50:03 -0600
On Thu, 2007-12-20 at 10:32 +0100, Toralf Lund wrote:
> Can I add an event hander for the "scroll event" on a SpinButton?
>
> I've tried
>
> bool ThisClass::OnScrollEvent(GdkEventScroll *event)
> {
> cerr << "ThisClass::onScrollEvent\n";
>
> return false;
> }
> ...
>
> spinbutton.signal_scroll_event().connect(sigc::mem_fun(*this,
> &ThisClass::onScrollEvent));
>
> (or rather, the equivalent code in a somewhat more complex class setup...)
>
> This builds all right, but the handler doesn't seem to get called, i.e.
> the text from "cerr" is never displayed. I also added
>
> spinbutton.set_events(Gdk::ALL_EVENTS_MASK);
>
> to make absolutely sure the event would be received, but it didn't make
> any difference.
>
> So, is there anything special about a SpinButton that prevents the above
> from working? I mean, this is based on code that has worked in the past
> for a simple Entry widget.
>
> In case you wondered, I'm trying to override/add to the default scroll
> handling in order to allow "spin" by different amounts depending on the
> modifier state.
>
I'm not sure, but I'm guessing this might be one of those signals where
you have to pass an extra 'false' parameter to connect() to tell it to
connect *before* the default handler (without that parameter, it
connects your handler *after* the default one)
--
Jonner
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]