Morph mouse up action (Smalltalk expression)
Last updated at 6:36 pm UTC on 2 August 2013
You can add a mouse up action (written as a Smalltalk expression in plaint text, or a MessageSend object built in your code ) to any Morph.
You may either choose from the morph's menu 'extras/add mouse up action' and get a FillInTheBlank object to type in the Smalltalk expression or you can evaluate the following expression in your code:
myMorph addMouseUpActionWith: 'a Smalltalk expression (a String)'
s := StringMorph new.
s contents: 'Games'.
s position: 100 @ 200.
s font: (TextStyle default fontArray at: 4) emphasis: 1.
s addMouseUpActionWith: '(Project named: ''Games'') enter'.
See for example ScorePlayer>makeAPauseEvent:
Note that this mechanism is completely open to abuse; you could simply add 'Smalltalk quitPrimitive' and your morph would cause an immediate quit on a mouse-up.
Also see Morphic Event Handling, SimpleButtonMorph