Alex Posted February 1, 2010 Share Posted February 1, 2010 I've never used PHP GTK2, or PHP GTK1 for that matter, so I decided to mess around it with. Using the documentation it seems pretty straightforward, but I have hit a snag. I'm using the GtkNotebook object and for one of its pages I've added a GtkVBox object. Like so: $this->main_list = new GtkVBox(); $this->book->append_page( $this->main_list, new GtkLabel('Main List') ); I then create a timer to run a function every 15 seconds (for example) and then call the function once at start-up as well. Gtk::timeout_add(1000 * 15, array($this, 'update')); $this->update(); The setup of the update method is basically like this: public function update() { // Attemping to remove all children from $this->main_list, if there are any foreach($this->main_list->get_children() as $child) { $this->main_list->remove($child); } foreach(...) // Some complex loops { // Construct a new GtkTable object ($table) // Add $table to $this->main_list $this->main_list->pack_start($table, false, false, 10); } return true; // otherwise the timer dies } Now, the first call to $this->update() works as expected and populates $this->main_list (on the GtkNotebook page) with the expected. However when it's called a second time by the timer instead of clearing all the children from the GtkNotebook page and populating it with the new newly constructed GtkTable objects the page is just cleared and nothing new is displayed. I've done all the debugging to make sure loops were producing the expected outputs and whatnot, so I figure it must be something simple I'm missing. Any ideas? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.