Probably because the control named "Label" is alredy defined in main code. Why do you try to create it once more? You should just modify its properties (text), something like this:
$main->Label->Text(rand()); -----Original Message----- From: Andrey [mailto:war...@mail.ru] Sent: Thursday, December 24, 2009 6:07 PM To: perl-win32-gui-users Subject: [perl-win32-gui-users] label is not visible after recreating inevent While researching memory leak in Win32::GUI I found out strange behavior of control. Here is an example: ===================== use strict; use Win32::GUI(); my $main = Win32::GUI::Window->new(-name => 'Main', -text => 'Perl', -width => 200, -height => 200); $main->AddLabel(-name => "Label", -text => "Hello, world", -left => 20, -top => 20, -notify => 1); sub Label_Click { { # "visibility" block $main->AddLabel(-name => "Label", -text => rand(), -left => 20, -top => 20, -notify => 1); $main->AddLabel(-name => "Label", -text => rand(), -left => 20, -top => 20, -notify => 1); } $main->AddLabel(-name => "Label", -text => rand(), -left => 20, -top => 20, -notify => 1); } $main->Show(); Win32::GUI::Dialog(); sub Main_Terminate { -1; } ======================= When you click on "Hello, world" label it just disappears. If you comment any of "$main->AddLabel" lines then everything will be OK. Why label disappears? Perl version: 5.10.1 build 1006 Win32::GUI version: 1.06 ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/