GtkNotebook in PHP-GTK 2

From: Date: Sat, 17 Sep 2005 14:58:20 +0000
Subject: GtkNotebook in PHP-GTK 2
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-6206@lists.php.net to get a copy of this message
Hi all, There are four items on the TODO related to GtkNotebook: 1. GtkNotebook->append_page should allow just a string as second parameter (title for page) instead of wanting a gtklabel Does anyone else want this? It could be implemented, but it's out of line with GTK+ behaviour, and I'll need to find out why it was implemented that way in the first place before making any changes to it in PHP-GTK 2. If people want it, I'll look into it, but otherwise this is leaving the TODO list - so please respond if you'd like that change to be implemented. NB append_page() currently acts as it did in PHP-GTK 1. 2. GtkNotebook crashes when connecting callback to move-focus-out signal To the best of my knowledge and belief, move-focus-out is intended purely as a keybinding signal and shouldn't be used for anything else. It works as advertised, so long as you don't try to connect anything further (ie a callback function) to it. 3. GtkNotebook can't use switch-page signal as GPointer isn't implemented I have a patch for this, pending Andrei's approval. 4. GtkNotebook->get_nth_page() crashes I can't reproduce this. Test script below: <?php function try_this($notebook) { echo sizeof($notebook->children)."\n"; /* returns 0, because 'children' - although accessible - is no longer a property inherited from GtkContainer in GTK 2 */ echo sizeof($notebook->get_children())."\n"; // returns 4, correctly echo $notebook->get_nth_page(2)->get_name()."\n"; // returns 'GtkLabel', correctly echo $notebook->get_nth_page(-1)->get_name()."\n"; // returns 'Named label', correctly echo $notebook->get_n_pages(); // returns 4, correctly } $window = new GtkWindow(); $window->connect_object('destroy', array('gtk', 'main_quit')); $notebook = new GtkNotebook(); $box = new GtkVBox(); $window->add($box); $notebook->append_page(new GtkLabel('Page1'), new GtkLabel('Label1')); $notebook->append_page(new GtkLabel('Page2'), new GtkLabel('Label2')); $notebook->append_page(new GtkLabel('Page3'), new GtkLabel('Label3')); $named_label = new GtkLabel('Page4'); $named_label->set_name('Named label'); $notebook->append_page($named_label, new GtkLabel('Label4')); $box->pack_start($notebook); $button = new GtkButton('Test for get_nth_page', 0); $button->connect_object('clicked', 'try_this', $notebook); $box->pack_end($button, false, false, true); $window->show_all(); gtk::main(); ?>

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