[Gtk-sharp-list] 2 Questions
Miguel de Icaza
miguel@ximian.com
25 Jul 2003 09:37:17 -0400
Hello!
> 2) Always in C I associated a Button press event to a window and in the
> callback function I could get the x, y coordinates of the mouse within
> the window. How can I get them in gth#?
>
> in C I used:
>
> shape_pressed (GtkWidget * widget, GdkEventButton * event, gpointer
> user_data) {
> if (event->x >= CLOSE_BTT_X_MIN && event->x <= CLOSE_BTT_X_MAX &&
> event->y >= CLOSE_BTT_Y_MIN && event->y <= CLOSE_BTT_Y_MAX)
> ...
Simple:
void ButtonHandler (object o, ButtonPressEventArgs a)
{
Gdk.EventButton pos = a.Event;
Console.WriteLine ("Clicked at: {0} {1}", pos.x, pos.y);
}
Miguel