Re: [gtk-list] Double Click Event



On Thu, 8 Jan 1998, Drizzt wrote:

> 
> 
> How can I catch a Double CLick event in a List Widget?.

hm, seems to become an FAQ, i have posted this before ;)

define a signal handler:

gint
signal_handler_event    (GtkWidget      *widget,
                         GdkEventButton *event,
                         gpointer       func_data)
{
        if (GTK_IS_LIST_ITEM(widget) &&
            ( event->type==GDK_2BUTTON_PRESS ||
              event->type==GDK_3BUTTON_PRESS) ) {

                printf("list item: i feel %s clicked on button %d\n",
                        event->type==GDK_2BUTTON_PRESS ? "double" : "triple",
                        event->button);
        }

        return FALSE;
}

and connect the handler to your object:

{
        ... list, listitem etc. 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...
}



> 
> Thanks in advance
> Drizzt
> 

---
ciaoTJ



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]