Re:Documented constants and methods are undefined... (1 viewing) (1) Guest
Favoured: 0
|
|
|
TOPIC: Re:Documented constants and methods are undefined...
|
|
|
|
Documented constants and methods are undefined... 1 Year, 8 Months ago
|
Karma: 0
|
|
... in PHP-GTK2 for Windows.
Examples:
None of the type constants, whether they be the old-style global constants (e.g., GTK_TYPE_STRING) or the new class constants (e.g., Gtk::TYPE_STRING), will work. However, the actual integer values of these constants will work.
Certain GDK static methods (e.g., Gdk:: pixmap_create_from_xpm_d) are undefined. Gdk:: pixmap_get_from_data appears to work, but the documentation doesn't adequately explain how it may be used as a surrogate for Gdk:: pixmap_create_from_xpm_d.
[NOTE: Extra spaces added to prevent smileys from being rendered instead of actual character sequence.]
I am using Windows XP Pro SP3 with the latest PHP/PHP-GTK2 bundle downloaded from the PHP site. Thanks in advance for your suggestions.
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
kksou (Admin)
Admin
Posts: 1233
|
|
|
|
|
|
|
Last Edit: 2008/12/29 00:34 By kksou.
|
|
|
The administrator has disabled public write access.
|
|
|
|
Re:Documented constants and methods are undefined... 1 Year, 8 Months ago
|
Karma: 0
|
|
kksou wrote:
It has changed to GObject::TYPE_STRING
Thanks for the info!
What about the pixmap-related methods? I was working with a sample script that was obviously old and contained some deprecated function calls, which were easily fixed. However, there is no indication in the manual that the aforementioned pixmap-related methods have been deprecated or moved to a different class.
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
kksou (Admin)
Admin
Posts: 1233
|
|
Re:Documented constants and methods are undefined... 1 Year, 8 Months ago
|
Karma: 20
|
Hi,
Yes, one problem with learning PHP-GTK2 is that documentation is little and not updated.
In case you're not aware, you might want to download a copy of the PHP-GTK Explorer that I've written:
http://www.kksou.com/php-gtk2/Tools/PHP-GTK-Explorer-v1.05.php
Using the PHP-GTK Explorer, try search for the keyword "xpm". You will see all the methods related to xpm. In addition, you will see the exact parameters that are required, and the object returned.
In your case, you might want to take a look at the following sample code:
Sample Code 134: How to change cursor over clickable GtkLabel - Part 3 - using xpm data?
Using the PHP-GTK Explorer, you will see that there are not too many methods for xpm. So what you can do is to read the xpm data into a pixbuf. There are much much more methods for pixbuf that allow you to manipulate the image.
Hope this helps.
Regards,
/kksou
|
|
|
|
|
|
|
Last Edit: 2008/12/29 22:31 By kksou.
|
|
|
The administrator has disabled public write access.
|
|
|
|
Re:Documented constants and methods are undefined... 1 Year, 8 Months ago
|
Karma: 0
|
kksou wrote:
In case you're not aware, you might want to download a copy of the PHP-GTK Explorer that I've written:
http://www.kksou.com/php-gtk2/Tools/PHP-GTK-Explorer-v1.05.php
Using the PHP-GTK Explorer, try search for the keyword "xpm". You will see all the methods related to xpm. In addition, you will see the exact parameters that are required, and the object returned.
I downloaded the explorer a few minutes ago. Very nifty tool!
It appears that GdkPixmap::create_from_xpm and GdkPixmap::create_from_xpm_data are the only two XMP-related methods that still exist. Note that these are now methods of GdkPixmap and not the static methods of Gdk shown in the reference at gtk.php.net. Hopefully this knowledge will enable me to devise an update for the obsolete sample code.
Thank you for all your help!
|
|
|
|
|
|
|
The administrator has disabled public write access.
|
|
|
|
Re:Documented constants and methods are undefined... 1 Year, 8 Months ago
|
Karma: 0
|
|
Okay, here's what I've found out. GtkPixmap is deprecated. I've no idea why that would affect the ability to call static methods on GdkPixmap, but it's a non-issue. GtkImage is now the preferred class for creating images. You can create images directly from PNG files, which is a heck of a lot easier than fooling around with XPM, PixBufs, and the like. The following code will place a PNG on a button:
<?php
$window =& new GtkWindow();
$window->set_title('pixmaps');
$window->set_default_size(200, 100);
$window->connect_simple('destroy',array('gtk','main_quit'));
$window->realize();
$btnTest = new GtkButton();
$btnTest->connect_simple('clicked',array('gtk','main_quit'));
$pxmTest = GtkImage::new_from_file('C:/WebServer/www/images/smileys/hmm.png');
$lblTest = new GtkLabel('Button with icon');
$hboxTest = new GtkHBox();
$hboxTest->pack_start($pxmTest);
$hboxTest->pack_end($lblTest);
$btnTest->add($hboxTest);
$window->add($btnTest);
$window->show_all();
Gtk::main();
?>
However, what I really wanted to do was use an image to make a transparent splash screen when the program starts. Any ideas?
|
|
|
|
|
|
|
Last Edit: 2009/01/01 08:23 By Burnt Okra.
|
|
|
The administrator has disabled public write access.
|
|
|
|
|