Re: Making Gtk::Button receive spin events (as per Gtk::SpinButton)



On 5/19/06, Nickolai Dobrynin <ndobrynin gmail com> wrote:
Hi.

 I am trying to re-implement Gtk::SpinButton using a container to start
with.  As part of the
 re-implementation, I need to emulate the scrolling (a.k.a. spinning)
functionality of the spin
 entry.  Is there any way I can make a Gtk::Button receive these special
spin events?  I
 have this trivial piece of code below, but it doesn't do what I need.
Anybody can please
 point me in the right direction?  (I suspect I'm doing something utterly
silly here).

 class SpinButton : public Gtk::Button {
 public:
   SpinButton() { add_events(Gdk::SCROLL_MASK); }
   SpinButton(const std::string& lbl) : Gtk::Button(lbl) {
add_events(Gdk::SCROLL_MASK); }
 protected:
   virtual bool on_scroll_event (GdkEventScroll* e)
   { std::cout << "This is never called" << std::endl; return
Gtk::Button::on_scroll_event(e); }
 };


I don't quite understand what you're trying to do here.  What are you
using to generate scroll events?  Is there any reason you can't just
use a Gtk::SpinButton?

Jonner



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