Re: widgets and drawing like Glade
| From: | Jake Cobb | Date: | Fri, 25 May 2007 15:00:27 +0000 |
| Subject: | Re: widgets and drawing like Glade | ||
| References: | 1 2 3 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-7855@lists.php.net to get a copy of this message | ||
Hello,
Hmm. So you still do not see the buttons after removing the
"return true;" line from doExpose()?
I see the buttons in both Linux (Kubuntu) and Windows XP. In Windows I don't see the rectangle for some reason.
If your problem is the rectangle not showing up, I'd have to look
at that some more. If you still aren't seeing the buttons, I'm not
sure what to say since I see them in both environments here.
-Jake Cobb
thomas favennec wrote:
Hi, Sorry, it doesn' work :-/ Peraps because i use window Xp. (??) Thomas. ----- Original Message ----- From: "Jake Cobb" <jake@lyrehc.com> To: "thomas favennec" <webmaster@redsofa.net> Cc: <php-gtk-general@lists.php.net> Sent: Thursday, May 24, 2007 11:52 PM Subject: Re: [PHP-GTK] widgets and drawing like GladeHello, This is sort of the inverse of your event box post. There are default handlers for many events, expose-event being one of them. By default, the GtkWindow would redraw itself and its children, but when doExpose() returns true, the chain ends and the children are not redrawn. Remove the return line from doExpose() and you'll see both buttons, one with a rectangle around it. -Jake Cobb thomas favennec wrote:Hi, I would like create a rectangle around gtkButton like Glade do it. I tried draw_rectangle method with expose event in the main window but widgets added in the window are now ... hidden ! <?php function doExpose($widget, $event) { global $button2; $gc = new GdkGC($widget->window); $gc->set_rgb_fg_color(new GdkColor(0,0,0)); $gc->set_rgb_fg_color(new GdkColor(0,0,0)); $widget->window->draw_rectangle($gc, false, $button2->allocation->x-1, $button2->allocation->y-1, $button2->allocation->width+1, $button2->allocation->height+1); return true; } $win = new GtkWindow(); $win->connect_simple('destroy', array('Gtk', 'main_quit')); $win->connect('expose-event', 'doExpose'); // this box and chids are hidden :-( $box = new gtkHbox(); $win->add($box); $box->set_border_width(2); $button = new gtkButton('test'); $box->pack_start($button,0); $button2 = new gtkButton('test'); $box->pack_start($button2,0); $win->show_all(); Gtk::main(); ?> Do you know what is wrong ? Thanks, Thomas.-- PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php