alpal has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,
I'm having a very strange problem with Win32::GUI. First off, I'm new to using this package. I found a tutorial online for Win32::GUI and have been trying to use the following to test and play around with:
use Win32::GUI; $main = Win32::GUI::Window->new( -name => 'Main', -text => 'Swg_checkit', -height => 300, -width => 400, ); $main->AddLabel( -text => "NOOO!!" ); $main->Show(); Win32::GUI::Dialog(); sub Main_Terminate { -1; }

Upon execution I get a windows (running xp) error saying an error has occurred in the perl command line interpretor. This code does work fine if I remove the
$main->AddLabel( -text => "NOOO!!" );

I tried this originally using active perl 5.6.x and using ppm to install Win32::GUI, then got the error, tried 5.8.x, installed Win32::GUI with ppm again, still error, tried installing on housemate's computer, still error. Is there a known problem with Win32::GUI and using the AddLabel method? Is there another method that can be used to accomplisht he same thing that won't give an error?

thanks for any help and advice.

Alan

Replies are listed 'Best First'.
Re: Win32::GUI bizarre problems??
by sheep (Chaplain) on Feb 14, 2004 at 22:15 UTC
    Hello,
    Maybe it sounds like a bug, but Win32::GUI documentation about the -name option clearly states that this option is necessary.
    A bit more about it here.
    -Sheep
      Thanks sheep for pointing out that the documentation says "-name" is required.

      However, I still consider it to be a bug, since it blows up perl (Actually, it blows up inside the C runtime lib), instead of plesently complaining to the user.

      "When you are faced with a dilemma, might as well make dilemmanade. "
      Thank you for the info! Just FYI the Win32::GUI tutorial at http://search.cpan.org/~acalpini/Win32-GUI-0.0.558/docs/tut/guitut1.pod that I was using has some flaws. Thanks again, Alan
Re: Win32::GUI bizarre problems??
by Popcorn Dave (Abbot) on Feb 14, 2004 at 21:05 UTC
    While looking for examples I came across this with examples here to look at.

    I've never played with this module, and if I'm wrong I'm sure someone else will correct this, but it appears you need to create a new object to apply your label to.

    Hope that helps!

    There is no emoticon for what I'm feeling now.

Re: Win32::GUI bizarre problems??
by NetWallah (Canon) on Feb 14, 2004 at 21:44 UTC
    Experimented with your code, and had the same error.

    Playing with it, I found that adding a -name to the label makes the problem go away.

    $main->AddLabel( -text => "NOOO!!" , -name => 'Label1', );
    Sounds like a bug.
    "When you are faced with a dilemma, might as well make dilemmanade. "
Re: Win32::GUI bizarre problems??
by jplindstrom (Monsignor) on Feb 15, 2004 at 18:48 UTC
    0.0.558 is way old. You should use the 0.0.670 release, it's a lot more stable (and it doesn't have the -name bug).

    /J