class Button sig ClickHandler(sender as Object, args as EventArgs) event click as ClickHandler def receiveMouseClick1 # pretend it's always in our bounds and we're enabled raise .click, this, EventArgs() # .warning. unnecessary "this" def receiveMouseClick2 raise .click, EventArgs() def receiveMouseClick3 raise .click, this # .warning. unnecessary "this" def receiveMouseClick4 raise .click class Program shared var _butt as Button var _clickCount = 0 def main butt = _butt = Button() listen butt.click, ref .handleClick assert .clickCount == 0 butt.receiveMouseClick1 assert .clickCount == 1 butt.receiveMouseClick2 assert .clickCount == 2 butt.receiveMouseClick3 assert .clickCount == 3 butt.receiveMouseClick4 assert .clickCount == 4 get clickCount from var def handleClick(sender as Object, args as EventArgs) assert sender is _butt assert (args to dynamic?) inherits EventArgs _clickCount += 1