[155] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] Re: Another list question

daemon@ATHENA.MIT.EDU (Tim Janik)
Thu May 15 07:33:21 1997

Date: Thu, 15 May 1997 13:32:33 +0200 (CEST)
From: Tim Janik <Tim.Janik@Hamburg.Netsurf.DE>
To: gtk-list@redhat.com
In-Reply-To: <199705150927.LAA10043@nietzsche.bowtie.nl>
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com

On Thu, 15 May 1997, Marc van Kempen wrote:

> Is it possible have an action performend when doubleclicking on 
> a listitem?
> 
> Judging from the list of signals possible for a list widget
> it does not seem possible:
> 	selection_changed
> 	select_child
> 	unselect_child
> 

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...
}


---
ciaoTJ

Tim.Janik@Hamburg.Netsurf.DE	[signature: <CENS||ED>]

--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post