Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 511803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:15:16+00:00 2026-05-13T07:15:16+00:00

My app is document-based, but the document consists of two folders, not one file.

  • 0

My app is document-based, but the “document” consists of two folders, not one file. The document’s initial window contains a couple of file pickers and a button; the action closes that window and opens a new one showing the results of the operation between the two folder hierarchies. (The two windows are significantly different in size; keeping both views in a tabless tabview and switching with that would be non-trivial.)

Here’s the code from my action method that closes the file-pickers window and opens the results window:

[self retain];
NSArray *existingWindowControllers = [[[self windowControllers] copy] autorelease];
for (NSWindowController *windowController in existingWindowControllers) {
    [windowController setShouldCloseDocument:NO];
    [windowController close];
    [self removeWindowController:windowController];
}
[self addWindowController:[[[NSWindowController alloc] initWithWindowNibName:@"ProjectFoldersDocument" owner:self] autorelease]];
[self showWindows];
[self release];

(I added the retain and release messages in a failed attempt to solve the problem.)

My problem is that the document gets released and deallocated after this action method finishes, despite my telling the initial window controller not to close the document. (That was another failed attempt to solve the problem.)

So, how can I replace the first window with another, for the same document, without the document dying off?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:15:17+00:00Added an answer on May 13, 2026 at 7:15 am

    I finally solved this by switching the removeWindowController: and close messages:

    [self removeWindowController:windowController];
    [windowController close];
    

    This would suggest that the window controller was closing its document on close. I don’t know why, because I’d told it not to on the immediately-previous line.

    I also removed the explicit retain and release messages. The problem did not return.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a document-based Core Data app. My main Core Data entity has several
I am generating an XML file from a VB.NET app. The document was generating
I saved my project.apk file, and I was reading this document: http://developer.android.com/guide/publishing/app-signing.html#setup and they
I have a Core Data document-based app which support undo/redo via the built-in NSUndoManager
I have a .NET 4 app which consists of the app and two class
In my document based app I call prepareWithInvocationTarget and registerUndoWithTarget for [self undoManager]. However,
Obviously the correct way for our app to generate a Word document based on
Environment: xcode 3.2.1, document-based core-data application. I have a document-based cocoa app which uses
I have an OSX core data app (non-document based) with several tables. I'd like
I've got a document based App using Core Data, and have a tableView which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.