PHP-GTK
Friday, August 22, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGtkWidget::add_accelerator
GtkWidget::add_mnemonic_labelnext

Last updated: Sun, 12 May 2013
view this page in English

GtkWidget::add_events

Lets the widget receive more events by adding the event masks to the list of to-be-notified-of event types.

With that, you can let e.g. a GtkButton receive "motion-notify-event"s which it doesn't do by default.

Example 150. Tracking mouse movement on a button with add_events

<?php
/**
* We let the button receive an event that normally
* is not recognized by using GtkWidget::add_events()
*/
$btn = new GtkButton('move the mouse');
$btn->add_events(Gdk::POINTER_MOTION_MASK);
$btn->connect('motion-notify-event', 'onMouseOver');
 
function onMouseOver($btn, $event) {
    $btn->set_label($event->x . ', ' . $event->y);
}
 
$wnd = new GtkWindow();
$wnd->set_default_size(200, 100);
$wnd->add($btn);
$wnd->show_all();
$wnd->connect_simple('destroy', array('Gtk', 'main_quit'));
Gtk::main();
?>

See also: get_events() , set_events()


User Contributed Notes
gtk.gtkwidget.method.add_events.php
add a note about notes
There are no user contributed notes for this page.


previousGtkWidget::add_accelerator
GtkWidget::add_mnemonic_labelnext

Last updated: Sun, 12 May 2013
view this page in English


credits 

PHP  Copyright © 2001-2014 The PHP Group
 All rights reserved.
Last updated: Sun May 12 20:51:01 2013 CEST