Re: mouse clicks.

From: Date: Wed, 19 Feb 2003 11:28:03 +0000
Subject: Re: mouse clicks.
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-3047@lists.php.net to get a copy of this message
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> -- James Cameron mailto:quozl@us.netrek.org http://quozl.netrek.org/

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