'From Squeak3.2alpha of 4 October 2001 [latest update: #4596] on 11 December 2001 at 10:48:56 am'! "Change Set: ViaSUnit-3-tk Date: 10 December 2001 Author: Ted Kaehler Bug exhibited by a GeeMailMorph. If you choose 'make scrollbar inboard', and then later choose 'make scrollbar retractable', it gets recursive errors, and you have to leave Squeak. The problem is that the scrollbar's owner is not nilled, and Morph>>privateAddMorph:atIndex: can't find it in the submorphs. My fix bulletproofs privateAddMorph:atIndex:. Also corrected the root problem by nilling the owner of the scrollbar when it is made retractable. The recent menu keys addition got a error if no menu existed. Just put in a check for nil in the right place."! !Morph methodsFor: 'private' stamp: 'tk 12/11/2001 10:34'! privateAddMorph: aMorph atIndex: index | oldIndex myWorld itsWorld | ((index >= 1) and: [index <= (submorphs size + 1)]) ifFalse: [^ self error: 'index out of range']. myWorld _ self world. (aMorph owner == self and: [(oldIndex _ submorphs indexOf: aMorph) > 0]) ifTrue: ["aMorph's position changes within in the submorph chain" oldIndex < index ifTrue: ["moving aMorph to back" submorphs replaceFrom: oldIndex to: index-2 with: submorphs startingAt: oldIndex+1. submorphs at: index-1 put: aMorph] ifFalse: ["moving aMorph to front" oldIndex-1 to: index by: -1 do:[:i| submorphs at: i+1 put: (submorphs at: i)]. submorphs at: index put: aMorph]] ifFalse: ["adding a new morph" aMorph owner ifNotNil: [itsWorld _ aMorph world. itsWorld == myWorld ifFalse: [aMorph outOfWorld: itsWorld]. aMorph owner privateRemoveMorph: aMorph]. aMorph privateOwner: self. submorphs _ submorphs copyReplaceFrom: index to: index-1 with: (Array with: aMorph). itsWorld == myWorld ifFalse:[aMorph intoWorld: myWorld]]. self layoutChanged. myWorld ifNotNil: [self addedOrRemovedSubmorph: aMorph].! ! !ScrollPane methodsFor: 'menu' stamp: 'tk 12/11/2001 10:45'! retractableOrNot "Change scroll bar operation" retractableScrollBar _ retractableScrollBar not. retractableScrollBar ifTrue: [self privateRemoveMorph: scrollBar. scrollBar privateOwner: nil] ifFalse: [(submorphs includes: scrollBar) ifFalse: [self privateAddMorph: scrollBar atIndex: 1]]. self extent: self extent! ! !PluggableListMorph methodsFor: 'menu' stamp: 'tk 12/10/2001 20:33'! getMenu: shiftKeyState "Answer the menu for this text view, supplying an empty menu to be filled in. If the menu selector takes an extra argument, pass in the current state of the shift key." | aMenu | aMenu _ super getMenu: shiftKeyState. aMenu ifNotNil: [aMenu commandKeyHandler: self]. ^ aMenu! !