GTK2::Button retrieved from Tie::IxHash hash value does not render



The simple program below:

use Gtk2 -init;
use Tie::IxHash;

# Gtk2->init; works if you didn't use -init on use

my $window = Gtk2::Window->new('toplevel');

my $vbox = Gtk2::VBox->new (FALSE, 0);
$window->add($vbox);

#tie my %button, Tie::IxHash;

$button{qbimport} = Gtk2::Button->new('Quickbooks Import');
$button{qbimport}->signal_connect( clicked => \&qbimport );

$button{quit} = Gtk2::Button->new('Quit');
$button{quit}->signal_connect( clicked => sub { Gtk2->main_quit } );


$vbox->add($button{$_}) for (keys %button);

$window->show_all;
Gtk2->main;

sub qbimport { }

works just fine if you dont tie the %button hash with Tie::IxHash.

However, if you do, then it fails with the error:
Gtk2::Button=HASH(0x29b317c) is not of type Gtk2::Widget at v2.pl line 19.

Is there a sensible reason why a retrieved value presented to ->add() would do this?



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