Re: simple problem
- From: Jeff Franks <jcf tpg com au>
- To: Clement Bourdarias <cbour mangoquest org>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: simple problem
- Date: Sun, 22 Sep 2002 13:27:16 +0000
Clement Bourdarias wrote:
Hello,
I'm fighting against elements to get a gtk+-2-based program working.
I've read some interesting sections in the doc, and I tried to catch a
mouse button event on a drawing area, created with gtk_drawing_area_new().
This should be very simple.
Well, I used gtk_widget_add_events() with GDK_BUTTON_PRESS_MASK, and set
up a callback which prints event->x and event->y.
event-x and event->y are doubles, not integers.
You say: "Cool, but what's your problem then ?"
The problem is that the values are absolutely wrong.
I _always_ get X=0 and Y=some_huge_value (like 1078951936).
Try this:
gboolean
button_event_callback (GtkWidget *widget, GdkEventButton *event,
gpointer data)
{
g_print ("clicked with button %d at (%.0f,%.0f) root: (%.0f,%.0f)\n",
event->button,event->x, event->y, event->x_root,
event->y_root);
return TRUE;
}
Jeff Franks
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]