PHP-GTK
Saturday, October 25, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousLoading the file
Changes since PHP-GTK 1next

Last updated: Sun, 12 May 2013
view this page in English

In large projects, you might have many windows defined in your .glade file, and all are loaded when loading the .glade file. That a) slows down the start of your application and b) shows all windows immediately, if you didn't set their visibility to hidden in Glade. Further, you may want to signal_autoconnect_instance() only a part of the .glade file to one object, while connecting another part to another object.

The solution to this problem is the second parameter of the GladeXML constructor: Just pass the id of the to-be root widget, and only this part of the .glade file will be loaded.

Example 4.6. Partially loading a .glade file

<?php
//Loading a part of the glade file only
 
//We want "btnClose" to be the root of the widget tree to load
$glade = new GladeXML('helloglade.glade', 'btnClose');
 
//That will work
$btn = $glade->get_widget('btnClose');
 
//This will fail, as the window isn't loaded:
$window = $glade->get_widget('wndClose');
//Output is NULL
var_dump($window);
?>

User Contributed Notes
tutorials.helloglade.partial.php
add a note about notes
There are no user contributed notes for this page.


previousLoading the file
Changes since PHP-GTK 1next

Last updated: Sun, 12 May 2013
view this page in English


credits 

PHP  Copyright © 2001-2014 The PHP Group
 All rights reserved.
Last updated: Sun May 12 20:51:01 2013 CEST