|
From: Louis B. <lb...@li...> - 2001-06-27 13:35:11
|
Thank you all.
I found I had to add the following before the sleep to terminate the loop:
exit(0) if !$W->IsEnabled();
And change my terminate sub to the following:
sub Window_Terminate {-1;print "";}
For some odd reason if I do not do a print the program will not=20
terminate. Anyone have any ideas why???
Thanks,
Louis
At 03:00 PM 6/27/2001 +0200, Johan Lindstrom wrote:
>Louis wrote:
>>$W =3D new Win32::GUI::Window(
>> -title =3D> "Win32::GUI::Louis Test",
>> -left =3D> 100,
>> -top =3D> 100,
>> -width =3D> 200,
>> -height =3D> 150,
>> -font =3D> $F,
>> -name =3D> "Window",
>>);
>
>Note the -name.
>
>
>>sub W_Terminate {-1;}
>
>Note the name. You use the name of a variable you happened to assign the=20
>the object to. All event handlers are named after the -name option. This=20
>should work better:
>
>sub Window_Terminate {-1;}
>
>I often find that my event code never gets run and wonder why. Then I=20
>insert a little
>
> print "!";
>
>in the handler sub and find that the event is never triggered at all...=20
>Oops :/ It is almost always caused by a misspelling or misunderstanding=20
>of the control name.
>
>
>BTW, it may be a test thing, but "Window" is a lousy name for a lot of=20
>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=F6m Boss Casinos
>Sourcerer jo...@ba...
> http://www.bahnhof.se/~johanl/
>If the only tool you have is a hammer,
>everything tends to look
>like a nail
>
>
>_______________________________________________
>Perl-Win32-GUI-Users mailing list
>Per...@li...
>http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
--
=A4=A4=BA=B0`=B0=BA=A4=F8,=B8=B8,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0=
=BA=A4=F8,=B8=B8,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0=BA=A4
=A4=B0`=B0Lightbridge, Inc
=A4=B0`=B067 South Bedford St.
=A4=B0`=B0Burlington MA 01832
=A4=B0`=B0781.359.4795 mailto:lb...@li...
=A4=B0`=B0http://www.lightbridge.com
=A4=A4=BA=B0`=B0=BA=A4=F8,=B8=B8,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0=
=BA=A4=F8,=B8=B8,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0=BA=A4
|