PHP-Code:
function getWidget($obj,$id) {
if ((!is_subclass_of($obj,'GtkContainer'))) {
return null;
} elseif ($obj->name == $id) {
return $obj;
} else {
foreach ($obj->get_children() as $child) {
if ($child->name == $id) {
return $child;
} elseif ($cchild = getWidget($child,$id)) {
return $cchild;
} else {
return false;
}
}
}
}
$id: Die ID des gesuchten Objekts
Einen Kommentar schreiben: