Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Rhose's scratchpad

by Rhose (Priest)
on Jun 01, 2004 at 15:35 UTC ( #358136=scratchpad: print w/ replies, xml ) Need Help??

For radiantmatrix

I saw your question about stopping the 'X' from closing a Tk window, so I pulled up one of my old apps and started playing. If I add the following line after creating the window ($gMainWindow), the text "Mooo!" will be printed each time the 'X' is pressed.

$gMainWindow->protocol("WM_DELETE_WINDOW", sub{print "Mooo!\n";});

By adding this code:

$gMainWindow->protocol("WM_DELETE_WINDOW", sub{print "Mooo!\n";sleep 5;$gMainWindow->destroy;});

The text "Mooo!" is printed, the program pauses 5 seconds, then the window closes. So... using this sub, present the user with a "Yes/No" message box... if they select yes, use a $gMainWindow->destroy, otherwise continue with the program.

Does this help?

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2014-07-29 02:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (211 votes), past polls