简体   繁体   English

如果按下班次,如何停止?

[英]How to halt only if shift is pressed?

in Pharo I'd like Object>>halt to halt only if shift is pressed, so that I don't break down my image. 在Pharo我喜欢Object>>halt只有在按下shift时停止,这样我才不会分解我的形象。 How do I do that? 我怎么做?

So, for example, I'd like to be able to add a self halt. 所以,例如,我希望能够添加一个self halt. into Array>>add: , without losing my image. 进入Array>>add: ,而不会丢失我的图像。

Object>>haltifShiftPressed
 Sensor leftShiftDown ifTrue: [self halt].

Cool, this Textbox can Syntax-Highlight Smalltalk-code 很酷,这个文本框可以语法 - 突出显示Smalltalk代码

自我停止:[传感器shiftPressed]

I'll do the following now, Merging Oscar's and Richard's solution: 我现在将执行以下操作,合并奥斯卡和理查德的解决方案:

Object>>h
  self haltIf: [Sensor shiftPressed]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM