> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Sisyphus > Sent: December 7, 2005 1:00 AM > To: perl-win32-users > Cc: [EMAIL PROTECTED] > Subject: Fw: Problem (bug?) in Perl/Tk > > > ----- Original Message ----- > From: "Geoff Horsnell" <[EMAIL PROTECTED]> > To: "Sisyphus" <[EMAIL PROTECTED]> > Sent: Wednesday, December 07, 2005 7:53 AM > Subject: RE: Problem (bug?) in Perl/Tk > > > > Thanks for your comment. I first tried updating the version > of Perl to > 5.8.7 > > to see if that cured the problem. It didn't. So, here is a > cut down perl > > script that demonstrates the problem. I attach the file. > Feel free to > submit > > it to the user group - I wasn't sure how to link it with my earlier > text.... > > > > Best way is to just reply to the list in the same thread and > provide the > script in the body of the email (not as an attachment). > No problem .... this post does it for you :-) > > If you still don't get help, try the 'ptk' mailing list. (For > details, go to > http://lists.cpan.org and click on the link to ptk. Search > their archive > first, as the problem might already have been covered.) > > Here's the script folks : > > use Tk; > use Tk::Button; > use Tk::Canvas; > use Tk::DialogBox; > use Tk::Tiler; > > use strict; > use warnings; > > # TEXT: Run this simple program. It creates a window entitled > "Tryit". It > has one > # menu item, entitled "Select". If you left click on > "Select", a sub-menu > appears > # with "Enter". Left click on "Enter" and an Entry sub-window > appears,entitled > # "Single Entry", with both an entry line, and two buttons, > entitled"Accept" > # and "Cancel". Selecting the "Cancel" button closes the > window. However, > selecting > # the "Close" button on the title bar should also close the > window. It does > for > # the main window ("tryit"), but NOT for the sub-window > ("Single Entry"). > > # Why is this? > > $::mWin = MainWindow->new; > $::mcanvas = $::mWin->Canvas(-height=>"5.c", -width=> "5.c"); > $::mcanvas->pack(-expand => 1, -fill => "both"); > $::topl = $::mWin->toplevel; > $::menub1 = $::topl->Menu(-type => "menubar"); > $::topl->configure(-menu => $::menub1); > $::menu1 = $::menub1->cascade(-label => "Select", -underline > => 0, -tearoff > => 0); > $::menu1->pack; > $::menu1->command(-label => "Enter", -underline => 0, -command => > \&setEnter); > $::menu1->pack; > &::MainLoop; > exit; > > sub setEnter { > my ($dialogb, $t1, $t1a, $t1b, $diagb, $val); > $dialogb = $::mWin->DialogBox (-title => "Single Entry", -buttons => > ["Accept", "Cancel"]); > $t1 = $dialogb->Tiler (-columns => 2, -rows => 1); > $t1a = $t1->Message (-justify => "right", -text => "Enter > Value", -width => > 100); > $t1b = $t1->Entry (-textvariable => \$val); > $t1b->get; > $t1->Manage ($t1a, $t1b); > $t1->pack; > $diagb = $dialogb->Show; > return; > } > > __END__ > Thanks for forwarding this on Rob. I was going to reply to the first post - but wasn't sure if Geoff was using a dialog or not (..however, I did suspect so)
Geoff can do one of two things: 1) Patch the Dialogbox.pm. It can be found at: http://groups.google.ca/group/comp.lang.perl.tk/msg/716684a805e27143 or 2) Bind the WM_DELETE_WINDOW protocol to invoke the cancel button in the program itself. To do this put the following code directly after the creation of the dialogbox. $dialogb->protocol('WM_DELETE_WINDOW'=> sub { $dialogb->Subwidget("B_Cancel")->invoke; }); HTH. Jack _______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
