class Button sig ClickHandler(sender as Object, args as EventArgs) event _click as ClickHandler def addClickHandler(clickhdlr as ClickHandler) listen _click, clickhdlr def _onMouseClick # pretend it's always in our bounds and we're enabled raise _click, EventArgs() def receiveMouseClick _onMouseClick class Program shared var _didClick = false def main butt = Button() butt.addClickHandler(ref .handleClick) assert not _didClick butt.receiveMouseClick assert _didClick def handleClick(sender as Object, args as EventArgs) _didClick = true