RE: Need advice on how to start processing after an NSDocument closes...

  • I probably should've done a better job of explaining it. This is a file transfer application. When the user is done selecting their files within the document's window they click send. At this point the document should be saved, closed, and put into a queue to be worked on. There will be another window that displays progress as it works its way through each document in the queue. It's similar  to sending an email, if you consider composing an email as working on a standalone document.

    So I need a way to tell my AppController to start working on the queue after the document closes.

    Thanks,
    William

    -----Original Message-----
    From: "Emanuele "$B!g(J" Vulcano" [mailto:<me...>]
    Sent: Friday, October 12, 2007 2:58 PM
    To: William E. Jens
    Cc: <cocoa-dev...>
    Subject: Re: Need advice on how to start processing after an NSDocument closes...

    Il giorno 12/ott/07, alle ore 21:00, William E. Jens ha scritto:

    > I think under PowerPlant I used calls to ProcessCommand() within my
    > document which were then handled in my main application after the
    > document closed. I'm unclear on how this is done within Cocoa.

    I believe that working on a document after it has been closed in the
    UI is poor form. You can override
    canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo: this way:

      - call super's implementation (shows the "save/don't save/cancel"
    panel). Change the delegate and selector so that you can process the
    return call yourself. (Storing the original as a NSInvocation and
    "volleying" can be a good idea.)
      - if it reports that it can be saved and there are no unsaved
    changes, then show a sheet with a progress indicator (maybe
    indeterminate) and do post-processing. The user will not be able to
    modify the document as long as the sheet is onscreen.
      - when you're fine, call the original closing delegate with an
    appropriate return value. Your document will be closed by this.

      - $B!g(J
  • On 12 Oct 2007, at 3:42 PM, William E. Jens wrote:

    > I probably should've done a better job of explaining it. This is a
    > file transfer application. When the user is done selecting their
    > files within the document's window they click send. At this point
    > the document should be saved, closed, and put into a queue to be
    > worked on. There will be another window that displays progress as it
    > works its way through each document in the queue. It's similar  to
    > sending an email, if you consider composing an email as working on a
    > standalone document.

    I think you may be conflating closing a window and closing a document.

    If you really need separate documents (that is, they relate to files),
    then why close the documents before you're done with them? Just hide
    the windows, and don't close the documents till you're done.

    — F
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today