Gtk2::Expander "expanded" property



Hi,

I'm experiencing a strange behavior from Gtk2::Expander's
?expanded? property.
If I connect to the ?activate? signal, I expect to get TRUE
when it is expanded, and FALSE when it is closed, but I get
the exact opposite.

Am I missing something?

I'm running mdv 2006

========================
#! /usr/bin/perl -w

use strict;
use Gtk2 '-init';
use Glib qw/TRUE FALSE/; 

#standard window creation, placement, and signal connecting
my $window = Gtk2::Window->new('toplevel');
$window->signal_connect('delete_event' => sub {
Gtk2->main_quit; });
$window->set_border_width(5);
$window->set_position('center_always');

#this vbox will return the bulk of the gui
my $vbox = &ret_vbox();

#add and show the vbox
$window->add($vbox);
$window->show();

#our main event-loop
Gtk2->main();

sub ret_vbox {

my $vbox = Gtk2::VBox->new(FALSE,5);

        my $expander = Gtk2::Expander->new_with_mnemonic('E_xpand
Me');
        
        $expander->set_expanded(TRUE);
        print "Expanded: ".$expander->get('expanded')."\n";
        
        $expander->add(Gtk2::Label->new("THIS IS SHOWN AND
HIDE"));
        
        $expander->signal_connect('activate' => sub {
        
                
                        
                if($expander->get_expanded) {
                
                print("The expander is expanded\n");
                
                }else{
                
                print("The expander is closed\n");
                }
        
        });
                
$vbox->pack_start($expander,TRUE,TRUE,0);       
$vbox->show_all();
return $vbox;
}

=================



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