Added managed event handling code to Cocoa example GUI.