Question about getting values from nested GTK::Boxes
- From: "Mike Martin" <redtux1 googlemail com>
- To: gtk-perl-list gnome org
- Subject: Question about getting values from nested GTK::Boxes
- Date: Wed, 7 Feb 2007 14:43:48 +0000
Hi
I have the following function which gets the values from nested h/vboxes.
sub get_files {
my ($sel_opts_vbox)= _;
my @files;
my @add_opts;
foreach my $child ($sel_opts_vbox->get_children){
if ($child->get_name eq 'filesel'){
foreach my $child1 ($child->get_children){
foreach my $child2 ($child1->get_children){
foreach my $child3 ($child2->get_children){
foreach my $child4 ($child3->get_children){
if ($child4->get_name eq 'GtkFrame'){
foreach my $child5 ($child4->get_children){
my $media=$child5->get_text;$media=~s/\n//g;
push (@files,$media)}
}
else
{foreach my $child5 ($child4->get_children){
if ($child5->get_name eq 'GtkComboBoxEntry'){
push(@files, $child5->get_active_text);
}
elsif ($child5->get_name eq 'GtkComboBox'){
push (@files,$child5->get_active_text);
}
}}}}}}}};
@files;
}
As you can see I am getting the values several levels deep from
dynamically inserted boxes from a container box
The function works well, but seems very clunky, so my question is
whether there is a better way to do this.
thanks
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]