Re: [gtk-list] Re: Getting selection from a CList?



On Thu, 03 Sep 1998, Aaron Walker wrote:
>Unfortunately, this only does single clicks :(
>does anyone know how to bind double click events to the clist?
>
>thanks,
>Aaron

this the way i did:

GtkWidget*  widget = gtk_clist_new(columns);
gtk_clist_set_selection_mode(GTK_CLIST(widget),GTK_SELECTION_EXTENDED);
gtk_widget_set_events(widget,
			  GDK_BUTTON_PRESS_MASK );
gtk_widget_set_events(GTK_CLIST(widget)->vscrollbar,
			  GDK_BUTTON_PRESS_MASK);
gtk_widget_set_events(GTK_CLIST(widget)->hscrollbar,
			  GDK_BUTTON_PRESS_MASK);
gtk_signal_connect(GTK_OBJECT(widget),
		       "button_press_event",
		       GTK_SIGNAL_FUNC(ButtonPressEvent),
		       (gpointer) NULL);
gtk_signal_connect(GTK_OBJECT(GTK_CLIST(widget)->vscrollbar),
		       "button_press_event",
		       GTK_SIGNAL_FUNC(ButtonPressEvent),
		       (gpointer) NULL);
gtk_signal_connect(GTK_OBJECT(GTK_CLIST(widget)->hscrollbar),
    	       "button_press_event",
    	       GTK_SIGNAL_FUNC(VDKCustomList::ButtonPressEvent),
    	       (gpointer) NULL);
/*...
uyo have to manage all events by yourself
*/
void ButtonPressEvent(GtkWidget *w,   GdkEventButton *event,  gpointer )
{
if(event->type == GDK_2BUTTON_PRESS)
    {
      // out your code here
    }
}

hope this help.
--
Mario Motta
===========
AI Research Group - Rimini
mmotta@guest.net
http://www.guest.net/homepages/mmotta/index.htm



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