     @setContent options.content                   if options.content
     @addSubView options.view,".kdmodal-content"   if options.view
 
+    @on 'ModalCancelled', options.cancel          if options.cancel
+
     @on "viewAppended", =>
       @utils.wait 500, => @unsetClass "initial"
 


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

    @on "childAppended", @setPositions.bind @


      @utils.wait =>
        @setClass "active"

  cancel:->
    @emit 'ModalCancelled'
    @destroy()

  destroy:()->
    $(window).off "keydown.modal"
    uber = KDView::destroy.bind(@)
