       @utils.wait =>
         @setClass "active"
 
+  cancel:->
+    @emit 'ModalCancelled'
+    @destroy()
+
   destroy:()->
     $(window).off "keydown.modal"
     uber = KDView::destroy.bind(@)

    @setContent options.content                   if options.content
    @addSubView options.view,".kdmodal-content"   if options.view

    @on "viewAppended", =>
      @utils.wait 500, => @unsetClass "initial"



    # @getSingleton("windowController").setKeyView @ ---------> disabled because KDEnterinputView was not working in KDmodal
    $(window).one "keydown.modal",(e)=>
      @cancel() if e.which is 27

    @on "childAppended", @setPositions.bind @

