Hello!

I've got the following code (at the end if the mail). Here I've got two 
buttons: one to change label's text and other to change its visibility. The 
text flip button works fine, whereas that connected with visibility 
doesn't.

Could you show me error in my code? Maybe there is a bug in Win32::GUI?

Waldemar

===============================================
#!perl -w

use strict;

use warnings;
use Win32::GUI;

my $state=1;

my $frame = new Win32::GUI::Window (
        -name   => 'okno',
        -width  => 200,
        -height => 200,
);

$frame->Center;

my $label = $frame->AddLabel(
        -name => 'label',
        -text => $state,
        -left => 110,-top=>70,width=>50,-height=>50,
);

my $button1 = $frame->AddButton(
        -name    => 'button1',
        -text    => 'visibility flip button',
        -onClick => 
eval('sub{$state=1-$state;$label->Change(-visibility=>$state);}'),
        -left=>10,-top=>20,width=>100,-height=>20,
);

my $button2 = $frame->AddButton(
        -name    => 'button2',
        -text    => 'text flip button',
        -left=>10,-top=>120,width=>100,-height=>20,
        -onClick => eval('sub{$state=1-$state;$label->Change(-text=>$state);}'),
);

$frame->Show();


sub Main_Terminate { -1 }

Win32::GUI::Dialog();
exit(0);
===============================================



Reply via email to