Re: mouse clicks.

From: Date: Wed, 19 Feb 2003 12:31:44 +0000
Subject: Re: mouse clicks.
References: 1 2  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-3048@lists.php.net to get a copy of this message
Thanks.... On Wednesday 19 February 2003 12:28, James Cameron wrote: > On Wed, Feb 19, 2003 at 11:47:25AM +0100, bertrand de baenst wrote: > > Is there a way to intercept the right mouse click on a button. > > Yes. > > Register a callback for the button press event against the widget > subclass of the GtkButton. Check the event structure for the button > number. > > Example from PHP-GTK manual, GtkWidget, button-press-event. > > <quote> > > button-press-event > > This is an event signal, fired when the connected widget picks up a > GDK_BUTTON_PRESS event. Button press events are generated by any of the > mouse buttons being pressed. You can distinguish between the mouse buttons > in the callback by using an if or switch statement: > > > function on_click($widget, $event, $data) { > switch($event->button) { > case 1: > /* do something appropriate to a left click */ > break; > case 2: > /* do something appropriate to a middle click */ > break; > case 3: > /* do something appropriate to a right click */ > break; > }} > > $widget->connect('button-press-event', 'on_click', $data); > > </quote>

« previous php.gtk.general (#3048) next »