Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Morph mouse up action (Smalltalk expression)
Last updated at 11:22 pm UTC on 6 June 2018
You can add a mouse up action (written as a Smalltalk expression in plain 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)'

Example:

  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'.
  s openInWorld

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, handlesMouseDown:
tagBeginner