Re: Howto for Pixmaps?
| From: | firepages.com.au | Date: | Tue, 07 Jan 2003 10:15:55 +0000 |
| Subject: | Re: Howto for Pixmaps? | ||
| References: | 1 2 3 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2852@lists.php.net to get a copy of this message | ||
There is an example in the manual ...
http://gtk.php.net/manual/en/gtk.gtkbutton.constructor.php
, ...theres a
nice little picture button class around somewhere but I cant find it or
remember where I found it :(
you can't just add an image to the button if you pass a label in the
constructor.. (at least thats the way it seems ?)
$yaks=&new GtkButton('label');
$yaks->add($image);
will die()
but
$box= &new GtkVbox();
$box->add($image);
$box->add($label);
$button->add($box);
is fine.
<?
(strtoupper(substr(PHP_OS, 0, 3)) ==
'WIN')?dl('php_gtk.dll'):dl('php_gtk.so');
$win = &new GtkWindow();
$win->connect('delete_event', create_function('',
'Gtk::main_quit();'));
$win->realize();
/*container to stick the button in*/
$box = &new GtkVbox();
/*load pixmap*/
list($pixmap, $mask) =
Gdk::pixmap_create_from_xpm($win->window,null,'/path/to/image.xpm');
$image = &new GtkPixmap($pixmap, $mask);
/*container for image*/
$image_container= &new GtkVbox();
$image_container->add($image);
/*make button*/
$button=&new GtkButton();
/*+ add image*/
$button->add($image_container);
/*add the image to the box*/
$box->add($button);
/*etc*/
$win->add($box);
$win->show_all();
Gtk::main();
?>
Regards,
Simon.
----- Original Message -----
From: "James Cameron" <quozl@us.netrek.org>
To: <php-gtk-general@lists.php.net>
Sent: Tuesday, January 07, 2003 5:32 PM
Subject: Re: [PHP-GTK] Howto for Pixmaps?
> Maaate, good one.
>
> But how do you add a pixmap to a button in place of or beside the label?
>
> --
> James Cameron mailto:quozl@us.netrek.org
> http://quozl.netrek.org/
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>