MVC: kill a window
Last updated at 3:32 pm UTC on 14 January 2006
Q: Is there a way to kill a window in Squeak without using the close button? Mark Guzdial
A: Here is a doIt which kills the window you're pointing at:
| ctrlToKill |
"Wait for mouse click"
[Sensor waitButton; redButtonPressed] whileFalse.
ctrlToKill _ ScheduledControllers scheduledControllers
detect: [:ctrl | ctrl viewHasCursor]
ctrlToKill = ScheduledControllers screenController ifTrue: [^self].
(Utilities confirm: 'Kill ', ctrlToKill view label)
ifTrue: [ctrlToKill closeAndUnschedule]