Skip to content

Getting the event details on event methods recipe

philippeback edited this page May 22, 2013 · 1 revision

The HTMLCanvas and TagBrush classes allow to deal with events pretty easily, like in:

MyWidget>>renderOn: html
   "html happens to be an HTMLCanvas"
   html p with: 'hello'; onClick: [ console log: 'clicked' ].
   "but how does one gets the event and associated details?"
   "... like this. And console log will give you all the drill down you need on the evt"
   html p with: 'hello again'; onClick: [ :evt | console log: evt ]. 

On events methods can either work with a block without parameters, or with parameters.

Clone this wiki locally