Read contents of Gtk2::Entry and Gtk2::ComboBox when button is pressed

I'm using Glade3 and Perl to make a Gtk GUI.
At the moment, I have 3 Gtk2::Entry and 3 Gtk2::ComboBox objects.
I want to read their contents when a button is pressed (the OK button).
To illustrate better, the user is entering his data (Entry) and makes
his selections (ComboBox) and hits a button that reads "OK" . At that
moment, I want to read in the contents of each Entry and Combobox.

Following is the code that I currently have (handles only one Entry
and one ComboBox). What changes should I do to accomplish the above?

$window= $builder->get_object('window1');

$window->signal_connect( "destroy" => sub {

$engine_cbox= $builder->get_object('combobox1');

my $model1 = new Gtk2::ListStore('Glib::String');
my $renderer1 = new Gtk2::CellRendererText;
$engine_cbox->pack_start($renderer1, FALSE);
$engine_cbox->set_attributes($renderer1, text => 0);

my @listing = qw/a b c d/;

foreach $text (@listing) {
    $engine_cbox->append_text ($text)

print "engine is $engine\n";

$source_Entry= $builder->get_object('entry1');
# $sourceimg= $source_Entry->get_text;

# $source_Entry->signal_connect(changed => \&convert, $source_Entry);
$source_Entry->signal_connect(changed => \&convert, $source_Entry);

$button= $builder->get_object('button1');

$button->signal_connect('clicked' => sub {my ($button,$userdata) =


$builder =undef;



sub convert {
        ($widget, $data) = @_;
        $text = $data->get_text();
#       print "$text and $engine\n";

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]