tags:

views:

23

answers:

1

I've wrapped a drawing area in an event box so that I can catch mouse clicks with this function:

protected virtual void OnEventbox1ButtonPressEvent (object o, Gtk.ButtonPressEventArgs args)
{
    Console.WriteLine("Clicked!");
}

How can I find out where the mouse clicked?

+2  A: 

Usually that information is stored in the args object. I'm not terribly familiar with Gtk, but I imagine it's not too dissimilar to the .Net click event implementation.

TreDubZedd
You seem to be right... I found four properties that help do the trick: `Console.WriteLine("Location relative to the current widget (" + args.Event.X + ", " + args.Event.Y + ")");` and `Console.WriteLine("Location relative to the computer screen (" + args.Event.XRoot + ", " + args.Event.YRoot + ")");`
Pieter