=== Top of the Swiki === Attachments ===

Kill The Window

Mark Guzdial wanted to know:

Is there a way to kill a window in Squeak without using the close button?

Here is a doIt which kills the window you're pointing at:


| ctrlToKill |
"Wait for mouse click"
[Sensor redButtonPressed] whileFalse.
ctrlToKill _ ScheduledControllers scheduledControllers
detect:[:ctrl| ctrl viewHasCursor] ifNone:[nil].
"Don't kill the ScreenColler (wouldn't work anyways)"
ctrlToKill = ScheduledControllers screenController ifTrue:[^self].
ctrlToKill ifNotNil:[
(Utilities confirm:'Kill ', ctrlToKill view label)
ifTrue:[ctrlToKill closeAndUnschedule]]