title: smalltalk Button event handling
body: <p>I am new with Squeak Smalltalk. How I can catch a button click event and execute some code when the button is clicked.</p>
  
  <p>I tried this code but it doesn't work!</p>
  
  <p>I created a new Button Class:</p>
  
  <pre><code>SimpleButtonMorph subclass: #ButtonTest
  instanceVariableNames: ''
  classVariableNames: ''
  poolDictionaries: ''
  category: 'test'
  </code></pre>
  
  <p>Inside this class I write this method:</p>
  
  <pre><code>handleMouseDown: event
  ^ true.
  </code></pre>
  
  <p>I want to use the button inside another Morph, so i created new Morph class: </p>
  
  <pre><code>RectangleMorph subclass: #RectangleMorphTest
  instanceVariableNames: 'textField button stringLabel mouseAction'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'test'
  </code></pre>
  
  <p>and inside Initialize method i compose buttonMorph inside RectangleMorph, The initialize method for rectangleMorph: </p>
  
  <pre><code>initialize  
  super initialize.
  self bounds: ((0@0) extent: (400@400)).
  self color: Color gray.
  
  textField := TextFieldMorph new. 
  textField color: Color lightYellow.
  textField contents: 'text'.
  textField bounds: ((25@25) extent: (300@75)).
  
  button := ButtonTest new.
  button borderWidth: 2.
  button bounds: ((150@150) extent: (200@200)).
  button label: 'print text'.
  button target: button.  
  button mouseDownOn: #yellowButtonPressed  event: [Transcript show: 'hello'].
  
  stringLabel := StringMorph new contents: 'This is a string'.
  stringLabel bounds:  ((150@180) extent: (200@200)).
  
  self addMorph: textField.
  self addMorph: button.
  self addMorph: stringLabel.
  </code></pre>
  
  <h1>Question</h1>
  
  <p>I tried to handle a Button event inside RectangleMorph, but it didn't work. So how I can handle a Button click event inside the RectangleMorph? </p>