The most common need for a GtkEventBox arises when a tooltip is required for a non-windowed widget.
Ejemplo 16. Giving a GtkLabel a tooltip.
<?php dl('php_gtk.' . (strstr(PHP_OS, 'WIN') ? 'dll' : 'so')); $window = &new GtkWindow(); $window->set_position(GTK_WIN_POS_CENTER); $window->connect_object('destroy', array('gtk', 'main_quit')); $eventbox = &new GtkEventBox(); $label = &new GtkLabel("This is a normal label. It cannot capture events."); $eventbox->add($label); $label->show(); $window->add($eventbox); $tooltip = &new GtkTooltips(); $tooltip->set_tip($eventbox, "So how did this get here?", null); $tooltip->enable(); $window->show_all(); gtk::main(); ?> |