Associates value with the calling object. value can be retireved by passing key when calling get_data() .
<?php // Create a GtkNotebook with several pages out of order. $notebook =& new GtkNotebook; for ($i = 0; $i < 6; $i++) { $frame =& new GtkFrame('Page ' . $i); $frame->set_data('intended_position', $i); // Add the pages out of order. if ($i % 2) { $notebook->prepend_page($frame, new GtkLabel('Tab ' . $i)); } } // Reorder the pages. $pages =& $notebook->children(); // Can't use foreach because it makes a copy. for ($page =& reset($pages); $page !== false; $page =& next($pages)) { $notebook->reorder_child($page, $page->get_data('intended_position'); } ?> |
See also: get_data() , remove_data()