Re: Test for whether a widget has children
- From: Kenneth Swanson <kswanson watson wustl edu>
- To: Mike Martin <mike redtux org uk>
- Cc: gtk-perl-list gnome org
- Subject: Re: Test for whether a widget has children
- Date: Fri, 23 Jul 2010 12:51:57 -0500
On 07/22/2010 08:05 PM, Mike Martin wrote:
Does such a thing exist in Gtk? eg: if I do something like
foreach my $widget ($vbox->get_children){
print $widget
}
It will fail if there are any widgets that dont have children such as
a label or a GTkEntry
So you just want to know, in the above code, whether $vbox is something with children?
I don't know of anything offhand, although there are methods in Gtk::Widget that makes it look like there
must be some way to figure it out.
However, why not do an isa check to see if it derives from Gtk2::Container?
if($vbox->isa('Gtk2::Container')) {
foreach my $widget ($vbox->get_children){
print $widget;
}
}
-Ken
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]