Squeak
  links to this page:    
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
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]
ifNone: [^self].
ctrlToKill = ScheduledControllers screenController ifTrue: [^self].
(Utilities confirm: 'Kill ', ctrlToKill view label)
ifTrue: [ctrlToKill closeAndUnschedule]