MdB
Group: Members
Posts: 6
Joined: Sep. 2007 |
|
Posted: Sep. 29 2007,21:43 |
|
gtk-double-click-time is not mentioned in the source for gtk 1.2 at all unfortunately which I guess says it isn't supported. Something must set the double click speed though....
There is an example in the FAQ for gtk 1.2 which I don't understand. Anybody follow this?
Code Sample | 5.7 How do I catch a double click event (in a list widget, for example)?
Tim Janik wrote to gtk-list (slightly modified):
Define a signal handler:
gint signal_handler_event(GtkWiget *widget, GdkEvenButton *event, gpointer func_data) { if (GTK_IS_LIST_ITEM(widget) && (event->type==GDK_2BUTTON_PRESS || event->type==GDK_3BUTTON_PRESS) ) { printf("I feel %s clicked on button %d\", event->type==GDK_2BUTTON_PRESS ? "double" : "triple", event->button); }
return FALSE; }
And connect the handler to your object:
{ /* list, list item init stuff */
gtk_signal_connect(GTK_OBJECT(list_item), "button_press_event", GTK_SIGNAL_FUNC(signal_handler_event), NULL);
/* and/or */
gtk_signal_connect(GTK_OBJECT(list_item), "button_release_event", GTK_SIGNAL_FUNC(signal_handler_event), NULL);
/* something else */ }
and, Owen Taylor wrote:
Note that a single button press will be received beforehand, and if you are doing this for a button, you will therefore also get a "clicked" signal for the button. (This is going to be true for any toolkit, since computers aren't good at reading one's mind.) |
|