How to stop only if shift is pressed?

in Pharo I would like it to Object>>halt

stop only when shift is pressed so that I don't break my image. How to do it?

So, for example, I would like to add self halt.

in Array>>add:

without losing images.

+2


source to share


3 answers


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

      



Cool, this textbox can syntactically highlight Smalltalk-code

+4


source


self haltIf: [Sensor shiftPressed]



+3


source


Now I will do the following: Merging Oscar and Richard solutions:

Object>>h
  self haltIf: [Sensor shiftPressed]

      

+2


source







All Articles