GtkFixed doesn't receive button_release_event ?!
| From: | Christophe VG | Date: | Fri, 28 Sep 2001 11:32:03 +0000 |
| Subject: | GtkFixed doesn't receive button_release_event ?! | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-163@lists.php.net to get a copy of this message | ||
Hi, I'm encountering problems trying to catch a button_release_event. It
seems a GtkFixed does not receive this event ?!!
This little code snip illustrates the (or my) problem ...
<?
dl( 'php_gtk.' . (strstr(PHP_OS, 'WIN') ? 'dll' : 'so'));
$window = &new GtkWindow;
$window->set_default_size( 200, 200 );
$fixed = &new GtkFixed;
$window->add( $fixed );
// button
$button = &new GtkButton( 'Up and Down' );
$fixed->put( $button, 50, 50 );
$button->connect( 'button_press_event', 'on_mouse_down' );
$button->connect( 'button_release_event', 'on_mouse_up' );
function on_mouse_down() { print "down\n"; }
function on_mouse_up() { print "up\n"; }
// fixed2
$fixed2 = &new GtkFixed;
$fixed->put( $fixed2, 0, 0 );
$button = &new GtkButton( 'Nothing' );
$fixed2->put( $button, 25, 25 );
$fixed2->connect( 'button_press_event', 'on_mouse_down' );
$fixed2->connect( 'button_release_event', 'on_mouse_up' );
$window->show_all();
Gtk::main();
?>
This builds a window with a fixed layout with a button and another fixed
layout also with a button (just to stretch the second fixed layout).
Both the first button and the second layout are connected to the same
signal handlers.
Pressing and releasing the mouse button on the first button gives the
expected result. Doing the same in the area where we can access the
fixed layout only returns down events.
Anyhow, I hope someone can point me to a solution or a reason for this
behaviour.
While you're at it, a fewe related things ...
1) is there a way to get the current mouse position ?
2) are the x,y coordinates passed to the signal handler of the
button_press and release ?
3) is there a mouse_move event ? ...
(and no I don't want to use dnd :) it comes close but not what I want )
C