Re: button_press_event don't works into gtkDrawingArea?¿
| From: | epplestun | Date: | Sat, 11 Oct 2003 09:48:40 +0000 |
| Subject: | Re: button_press_event don't works into gtkDrawingArea?¿ | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-3954@lists.php.net to get a copy of this message | ||
Hi, I found the solution, adding this code works perfect:
$d->set_events(GDK_BUTTON_PRESS_MASK);
El sáb, 11 de 10 de 2003 a las 11:38, epplestun escribió:
> Hello, I'm working with gtkDrawingArea and when I try to do something
> when I press into the drawing area does not do anything, the code is:
>
> <?PHP
> dl('php_gtk.so');
>
> function fill($drawingarea, $event, $style, $gdkwindow) {
> $colormap = $gdkwindow->colormap;
> $color = $gdkwindow->new_gc();
> $color->foreground = $colormap->alloc('#ffcc00');
> gdk::draw_rectangle($gdkwindow, $color, true, 0, 0, 200, 220);
> }
>
> function onPress($widget, $event, $string) {
> echo $string;
> }
>
> $v =& new gtkwindow();
> $v->set_usize(200, 200);
> $v->connect_object('destroy', array('gtk', 'main_quit'));
> $d =& new gtkdrawingarea();
> $v->add($d);
> $d->size(200, 220);
> $d->realize();
> $style = $d->style;
> $gdkwindow = $d->window;
> $d->connect('expose_event', 'fill', $style, $gdkwindow);
> $d->connect('button_press_event', 'onPress', "bye bye\n");
> $d->show();
>
> $v->show_all();
> gtk::main();
> ?>
>
> Thx