Re: example from Mastering Perl/Tk
by Michael van Nieuwenhuize other posts by this author
May 8 2003 7:08PM messages near this date
Re: example from Mastering Perl/Tk
|
Re: example from Mastering Perl/Tk (correction)
Marc,
It actually does not work. On my machine the button will get populated into
the mainWindow, so pushing close will deiconify the mainWindow. No actual
toplevel is created. I was typing faster than thinking when I sent out the
mail. Then realize that I too had made a mistake, and sent out the
following correction.
$tl=$mw-> Toplevel();
Thanks for catching my error.
Mike
At 02:51 PM 5/8/2003 -0400, Marc Dashevsky wrote:
> At 01:26 PM 5/8/2003, Michael van Nieuwenhuize wrote:
> >Try changing
> >
> >$tl = $mw->TopLevel();
> >
> >t
> >
> >$tl = $mw->toplevel();
> >
> >This seemed to work on my machine.
>
> I'm very surprised to hear this. Toplevel requires an upper-case 'T'.
>
> >At 09:45 AM 5/8/2003 -0700, Tim Harsch wrote:
> >>Hi all,
> >>
> >>I typed in this example, as far as I can tell, exactly as it appears in the
> >>CH11, p.233 of the book.
> >>
> >>use Tk;
> >>
> >>$mw = MainWindow->new();
> >>$mw->title("MainWindow");
> >>$mw->Button( -text => "TopLevel", -command => \&do_TopLevel )->pack();
> >>
> >>MainLoop;
> >>sub do_TopLevel {
> >> if( ! Exists($tl) ) {
> >> $tl = $mw->TopLevel();
> >> $tl->title("TopLevel");
> >> $tl->Button( -text => "Close",
> >> -command => sub { $tl->withdraw })->pack();
> >> } else {
> >> $tl->deiconify();
> >> $tl->raise();
> >> } # end if
> >>} # end sub
> >>
> >>
> >>I get errors I don't understand when I try to run it:
> >>Tk::Error: Can't locate auto/Tk/TopLevel.al in @INC (@INC contains:
> >>C:\Program Files\ActiveState Komodo 2.3 C:/Perl/lib C:/Perl/site/lib .) at
> >>C:\Documents and Settings\Tim Harsch.BBRP2000\My Documents\Book
> >>Code\mastperltk_examples\mptk-code14\ch11\TopLevel.pl line 11
> >> Carp::croak at C:/Perl/lib/Carp.pm line 119
> >> AutoLoader::AUTOLOAD at C:/Perl/lib/AutoLoader.pm line 104
> >> main::do_TopLevel at C:\Documents and Settings\Tim Harsch.BBRP2000\My
> >>Documents\Book Code\mastperltk_examples\mptk-code14\ch11\TopLevel.pl
> line 11
> >> [\&main::do_TopLevel]
> >> Tk callback for .button
> >> Tk::__ANON__[C:/Perl/site/lib/Tk.pm:228] at C:/Perl/site/lib/Tk.pm
> line 228
> >> Tk::Button::butUp at C:/Perl/site/lib/Tk/Button.pm line 113
> >> (command bound to event)
> >>
> >>
> >>Help.
>
> -++**==--++**==--++**==--++**==--++**==--++**==--++**==
> This message was posted through the Stanford campus mailing list
> server. If you wish to unsubscribe from this mailing list, send the
> message body of "unsubscribe ptk" to majordomo@[...].edu
Michael van Nieuwenhuize
Phone: (858) 651-7413
Pager: (858) 636-9438 or
michaelv@[...].com
email : michaelv@[...].com
Office: BB-122E
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
Thread:
Marc Dashevsky
Michael van Nieuwenhuize
|