Louis wrote:
$W = new Win32::GUI::Window(
    -title    => "Win32::GUI::Louis Test",
    -left     => 100,
    -top      => 100,
    -width    => 200,
    -height   => 150,
    -font     => $F,
    -name     => "Window",
);

Note the -name.


sub W_Terminate {-1;}

Note the name. You use the name of a variable you happened to assign the the object to. All event handlers are named after the -name option. This should work better:

sub Window_Terminate {-1;}

I often find that my event code never gets run and wonder why. Then I insert a little

 print "!";

in the handler sub and find that the event is never triggered at all... Oops :/ It is almost always caused by a misspelling or misunderstanding of the control name.


BTW, it may be a test thing, but "Window" is a lousy name for a lot of reasons, some actually important. I discuss this in The GUI Loft User Manual:

<http://www.bahnhof.se/~johanl/perl/Loft/manual.html#control%20names%20are%20global>


/J

------ ---- --- -- -- -- -  -   -    -        -
Johan Lindström                    Boss Casinos
Sourcerer                     [EMAIL PROTECTED]
                 http://www.bahnhof.se/~johanl/
If the only tool you have is a hammer,
everything tends to look
like a nail


Reply via email to