如何从self中移除smalltalk中HandleMorph的附件

如何从self中移除smalltalk中HandleMorph的附件,smalltalk,squeak,gnu-smalltalk,Smalltalk,Squeak,Gnu Smalltalk,我需要你的帮助 我用这段代码创建了一条从特定位置到鼠标位置的线。 点击后,我试图删除这一行,但我不知道如何 请在单击后帮助我删除live,我应该更改什么 stk:= (LineMorph from: 100@100 to: 1300@1300 color: Color red width: 2) openInWorld. handle := HandleMorph new forEachPointDo: [:newPoint | stk setVertices: {whiteBallinHo

我需要你的帮助 我用这段代码创建了一条从特定位置到鼠标位置的线。 点击后,我试图删除这一行,但我不知道如何 请在单击后帮助我删除live,我应该更改什么

stk:=  (LineMorph from: 100@100 to: 1300@1300 color: Color red width: 2) openInWorld.
handle := HandleMorph new forEachPointDo:  [:newPoint | stk setVertices: {whiteBallinHole position. (newPoint-(10@10)). }.
stk on: #mouseDown send: #value: to:[:evt|
    evt redButtonPressed ifTrue:[  self handlesMouseDown:  evt.
stk color: Color transparent.
stk delete.
“鼠标单击后删除棍子此操作无效请帮助”

stk color: Color transparent.
stk delete.
“”

stk color: Color transparent.
stk delete.

代码有点乱。一件不合适的事情是

stk color: Color transparent.
stk delete.
self handlesMouseDown: evt.
如果您希望接收mouseDown:messages,则应该返回true。 在工作区中,该自我不存在。结果永远不会被使用。删除它就行了。生成的代码类似于

stk color: Color transparent.
stk delete.
whiteBallinHole := CircleMorph new openInWorld .
stk := (LineMorph 
    from: 100@100 to: 1300@1300 
    color: Color red 
    width: 4) openInWorld.
handle := HandleMorph new forEachPointDo: [ :newPoint | 
stk setVertices: {whiteBallinHole center. (newPoint-(10@10)). }.
stk on: #mouseDown send: #value: to: [:evt|
    evt redButtonPressed ifTrue:[
        stk color: Color transparent.
        stk delete]]].
self currentHand attachMorph: handle.