Re: [gtk-list] Question about CList Widgets

Achint Sandhu wrote:
> Hi,
>         Here is a newbie question. I am trying to register a double
> clicked
> handler for a CList box, i.e., when someone double clicks a list item, I
> want my function to be called...

You can connect to the clist's 'select_row' signal as normal.
You just have to check the event type to see if it is a double-click.

  ... create clist ...
  gtk_signal_connect (GTK_OBJECT (clist), "select_row",
                      GTK_SIGNAL_FUNC (on_clist_select_row),

on_clist_select_row                   (GtkCList        *clist,
                                       gint             row,
                                       gint             column,
                                       GdkEvent        *event,
                                       gpointer         user_data)
  if (event && (event->type == GDK_2BUTTON_PRESS))
        /* a row has been double-clicked. */


There's a bug in GTK which means you probably shouldn't hide the clist
in your double-click code.


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