Re: GraphicsContext Out of Context?

From: Date: Fri, 11 Aug 2006 13:57:53 +0000
Subject: Re: GraphicsContext Out of Context?
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-7086@lists.php.net to get a copy of this message
Hi Ronald, This is a user question, not a development question, so I'm moving it to the general list.
While playing around with the GtkDrawingArea widget, I came across something that's got me scratching my head. Perhaps I'm just not thinking straight this morning, but... Why does a GtkDrawingArea need to be connected to an expose event before its GdkWindow is instantiated?
Drawing occurs following an expose event. This is simply the way it works in GTK+, nothing to do with the language bindings. http://developer.gnome.org/doc/GGAD/sec-gdkevent.html#SEC-EXPOSEEVENTS The reason it works this way is there's no memory of what was drawn, so an expose event triggers a redraw (full or partial). You could think of it a bit like forcing a web page to reload after there's been some update to the information there... only it's much, much faster. - Steph
This works: <?php function doExpose($widget, $event) { $graphicsContext = new GdkGC($widget->window); var_dump($graphicsContext); } $window = new GtkWindow(); $drawingArea = new GtkDrawingArea(); $window->connect_simple('destroy', array('Gtk', 'main_quit')); $drawingArea->connect('expose-event', 'doExpose'); $window->add($drawingArea); $window->show_all(); Gtk::main(); ?> And this doesn't: <?php function doExpose($graphicsContext) { var_dump($graphicsContext); } // doExpose() $window = new GtkWindow(); $drawingArea = new GtkDrawingArea(); $graphicsContext = new GdkGC($drawingArea->window); $window->connect_simple('destroy', array('Gtk', 'main_quit')); $drawingArea->connect_simple('expose-event', 'doExpose', $graphicsContext); $window->add($drawingArea); $window->show_all(); Gtk::main(); ?> Any insights would very much appreciated. -Ron T. -- PHP-GTK Development Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __________ NOD32 1.1380 (20060125) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com


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