OK, don't do this at home, but even so, this shouldn't permanently
disable the system... Using Squeak 4.1 + Seaside 3.0: myWindow := (SystemWindow labelled: 'test') openInWorld. myArray := Array new: 10. "add zero or more morphs to myArray, but less than myArray size" myWindow addAllMorphs: myArray. "squeak stops working..." Lawson |
Hello Lawson
Please try this.... | myWindow m1 | myWindow := SystemWindow labelled: 'test'. myWindow model: Model new. "A system window needs a model" 1 to: 10 do: [ :i | m1 := EllipseMorph new.. myWindow addMorph: m1 frame: (0@0 corner: (i/10) @1). "system windows are made for tools, and they try to maintain a color scheme. SystemWindows nowadays set the color of added morphs to white. But when you alter the color after adding it, it stays. So we do the color now..." m1 color: Color random]. myWindow openInWorld. Does this help? Hannes On 11/5/10, Lawson English <[hidden email]> wrote: > OK, don't do this at home, but even so, this shouldn't permanently > disable the system... > Using Squeak 4.1 + Seaside 3.0: > > > myWindow := (SystemWindow labelled: 'test') openInWorld. > > myArray := Array new: 10. > > "add zero or more morphs to myArray, but less than myArray size" > myWindow addAllMorphs: myArray. > > "squeak stops working..." > > > Lawson > > > > > > > > > |
Thanks. I know there are many different ways of doing what I was trying
to do. I was just pointing out a simple mistake that was hanging the system. Passing a nil value in a message should never cause a complete lockup, IMHO. Lawson > Hello Lawson > > Please try this.... > > | myWindow m1 | > > myWindow := SystemWindow labelled: 'test'. > myWindow model: Model new. > "A system window needs a model" > > 1 to: 10 do: [ :i | m1 := EllipseMorph new.. > myWindow addMorph: m1 frame: (0@0 corner: (i/10) @1). > > "system windows are made for tools, > and they try to maintain a color scheme. > SystemWindows nowadays set the color of added morphs to white. > But when you alter the color after adding it, it stays. > So we do the color now..." > > m1 color: Color random]. > > myWindow openInWorld. > > > Does this help? > > > Hannes > > > On 11/5/10, Lawson English<[hidden email]> wrote: >> OK, don't do this at home, but even so, this shouldn't permanently >> disable the system... >> Using Squeak 4.1 + Seaside 3.0: >> >> >> myWindow := (SystemWindow labelled: 'test') openInWorld. >> >> myArray := Array new: 10. >> >> "add zero or more morphs to myArray, but less than myArray size" >> myWindow addAllMorphs: myArray. >> >> "squeak stops working..." >> >> >> Lawson >> >> >> >> >> >> >> >> >> > |
Yes it should have a test --- maybe you have a look at the method below ;-)
pretty complicated, could need some comment and refactoring. I wonder what this is all needed for.... HJH Morph>> privateAddAllMorphs: aCollection atIndex: index "Private. Add aCollection of morphs to the receiver" | myWorld otherSubmorphs | myWorld := self world. otherSubmorphs := submorphs copyWithoutAll: aCollection. (index between: 0 and: otherSubmorphs size) ifFalse: [^ self error: 'index out of range']. index = 0 ifTrue:[ submorphs := aCollection asArray, otherSubmorphs] ifFalse:[ index = otherSubmorphs size ifTrue:[ submorphs := otherSubmorphs, aCollection] ifFalse:[ submorphs := otherSubmorphs copyReplaceFrom: index + 1 to: index with: aCollection ]]. aCollection do: [:m | | itsOwner itsWorld | itsOwner := m owner. itsOwner ifNotNil: [ itsWorld := m world. (itsWorld == myWorld) ifFalse: [ itsWorld ifNotNil: [self privateInvalidateMorph: m]. m outOfWorld: itsWorld]. (itsOwner ~~ self) ifTrue: [ m owner privateRemove: m. m owner removedMorph: m ]]. m privateOwner: self. myWorld ifNotNil: [self privateInvalidateMorph: m]. (myWorld == itsWorld) ifFalse: [m intoWorld: myWorld]. itsOwner == self ifFalse: [ self addedMorph: m. m noteNewOwner: self ]. ]. self layoutChanged. On 11/5/10, Lawson English <[hidden email]> wrote: > Thanks. I know there are many different ways of doing what I was trying > to do. I was just pointing out a simple mistake that was hanging the > system. Passing a nil value in a message should never cause a complete > lockup, IMHO. > Lawson > >> Hello Lawson >> >> Please try this.... >> >> | myWindow m1 | >> >> myWindow := SystemWindow labelled: 'test'. >> myWindow model: Model new. >> "A system window needs a model" >> >> 1 to: 10 do: [ :i | m1 := EllipseMorph new.. >> myWindow addMorph: m1 frame: (0@0 corner: (i/10) @1). >> >> "system windows are made for tools, >> and they try to maintain a color scheme. >> SystemWindows nowadays set the color of added morphs to white. >> But when you alter the color after adding it, it >> stays. >> So we do the color now..." >> >> m1 color: Color random]. >> >> myWindow openInWorld. >> >> >> Does this help? >> >> >> Hannes >> >> >> On 11/5/10, Lawson English<[hidden email]> wrote: >>> OK, don't do this at home, but even so, this shouldn't permanently >>> disable the system... >>> Using Squeak 4.1 + Seaside 3.0: >>> >>> >>> myWindow := (SystemWindow labelled: 'test') openInWorld. >>> >>> myArray := Array new: 10. >>> >>> "add zero or more morphs to myArray, but less than myArray size" >>> myWindow addAllMorphs: myArray. >>> >>> "squeak stops working..." >>> >>> >>> Lawson >>> >>> >>> >>> >>> >>> >>> >>> >>> >> > > |
Free forum by Nabble | Edit this page |