Mouse Events and Gtkmm/Gdk



Hello,

I’m slightly confused as to how mouse events work with gdk, gtk, and gtkmm.

I just wanted to test out some basic functions to test out mouse handling and keyboard handling.

 

The following is my main window class that I use to start Gtkmm.  There is nothing fancy, and there is really no interaction.  Basically I just want to press keys and mouse buttons and have information printed to stdout.

 

Class MyWindow : public Gtk::Window

{

 

Public:

            MyWindow();

virtual ~MyWindow();

 

virtual bool on_key_release_event(GdkEventKey *event)
{

            cerr << event->keyval << endl;

return true;

}

 

virtual bool on_button_event(GdkEventButton *event)

{

            cerr << event->type << endl;

            return true;

}

 

};

 

When I instantiate this class as my main gtk window and run the program, it prints out all the keyboard strokes that I touch.  However, when I do any mouse button pressing, nothing is printed out to the screen.  Am I using the wrong event type for mouse presses, or must I do something special to log mouse presses?

 

Thanks,

Aaron Geier



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