perl Gtk2 widget->foreach() with same values -
i'm creating gtk2 based nftables config software, , heres problem:
i have hbox no input @ beginning. then, user can press add button, first instance of drop down list appears. made signal connect when button pressed , in sub create drop down list. after creation pack created thing hbox , returns. if user clicks time on add button, instance appears. @ end of code dropdown information should read , put together.
my idea hbox->foreach() function , read data get_active_value().
but, after all, string contains last value. when print out values while foreach, last value appears, too.
so, fault? thank ;)
edit if select "foo_1" , "foo_2" first vbox , "bar_1" , "bar_2" in second one, returned string contains "bar_1 bar_2 bar_1 bar_2".
code
my $hbox = gtk2::hbox->new(); $button->signal_connect('clicked', sub { $vbox = gtk2::vbox->new(); $dropdown = gtk2::combobox->new_text(); $dropdown_2 = gtk2::combobox->new_text(); #... create values ... $vbox->pack_start($dropdown,false,false,5); $vbox->pack_start($dropdown_2,false,false,5); $hbox->pack_start($vbox, false,false,5); }) ... $final; $hbox->foreach(sub { $final = $final.$dropdown->get_active_text().$dropdown_2->get_active_text(); } ); print $final;
Comments
Post a Comment