Re: Help with get_text() for Gtk3::Entry widget



14.04.2014, 09:40, "tsuyoshi okita" <825864 gmail com>:
This is my code snippet:

It's hard to say anything out of your snippet, because it's just a part of a whole code. Try to provide 
minimal and complete test case that will show the problem.

BTW, here is my test case, that works fine:

#!/usr/bin/perl
use warnings;
use strict;
use Gtk3 -init;
 
sub test_get_text_calling {
    my ($button, $entries_ref) = @_;
    warn $entries_ref->[0]->get_text();
}

my $window = Gtk3::Window->new('toplevel');
$window->signal_connect(delete_event => sub { Gtk3->main_quit() });

no strict 'refs';
my $row = 1;

# Test item
${ "entry_" . $row } = Gtk3::Entry->new;

# Test item
my @test_array = ( ${ "entry_" . $row } );

${ "entry_" . $row }->signal_connect(
    'changed' => sub {
        warn "You've entered: ", ${ "entry_" . $row }->get_text();
    }
);

my $hbox = Gtk3::HBox->new();
my $button = Gtk3::Button->new('Call get_text()');
$button->signal_connect('clicked',
                        \&test_get_text_calling,
                        \ test_array);
$hbox->add(${ "entry_" . $row });
$hbox->add($button);
$window->add($hbox);
$window->show_all();
use strict 'refs';

Gtk3->main();


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