jcornwall's picture

Receiving click events with GLWidget

This isn't strictly an OpenTK question as it is based on jtalton's GLWidget, which I need for portability, rather than GLControl.

I'm using GLWidget successfully on Linux and Windows in my application. I want to receive mouse button press events but neither of these approaches invoke the event handler when I click the widget:

protected override bool OnButtonPressEvent(Gdk.EventButton e) {
  Console.WriteLine("Button pressed");
  return true;
this.ButtonPressEvent += new ButtonPressEventHandler(HandleButtonPress);
protected void HandleButtonPress(object sender, ButtonPressEventArgs args) {
  Console.WriteLine("Button pressed");

GLWidget is a Gtk.DrawingArea so it should receive button presses. Am I missing something?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jcornwall's picture

Always the way, make a post and then the solution reveals itself. :)