[Gtk-sharp-list] How to set the fields of properties of Gdk.Event

Matt Guo matt at mattguo.com
Mon Dec 7 20:07:32 EST 2009


Hey,

I want to send a mouse event to a given window. The C code for this
would be like:

bool SendMousePress (MouseButton type, x, y) {
  GdkEvent* event = gdk_event_new(GDK_BUTTON_PRESS);
  event->button.button = type == LEFT ? 1 : (type == MIDDLE ? 2 : 3);
  event->button.x = x;
  event->button.y = y;
  ... //other event fields setting
  gdk_event_put(event);
  gdk_event_free(event);
}

The problem I have now is that though I can replace "gdk_event_new",
"gdk_event_put" and "gdk_event_free" with Gdk.EventHelper.New,
Gdk.EventHelper.Put
and Gdk.EventHelper.Free, but how can I set the event fields with
gdk-sharp? Since all properties in the Gdk.Event class are read-only.

Thank you.

-- 
B.R.
GUO Rui (Matt)


More information about the Gtk-sharp-list mailing list