• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Automatic opening of a DataFile at awakeFromNib??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatic opening of a DataFile at awakeFromNib??


  • Subject: Re: Automatic opening of a DataFile at awakeFromNib??
  • From: Graham Perks <email@hidden>
  • Date: Tue, 29 Aug 2006 20:10:46 -0500

I'm a Cocoa newbie but I found some code that will load up from the MRU list. That's close to what you want. Basically you create an AppController.h and .m. The meat of the .m is below. In MainMenu.nib, read AppController.h then select the File's Owner, go to Inspector and look at the Outlets. Set the one called Delegate to AppController. AppController is a fairly standard name so you could do some searches on that for more information.

-(BOOL)applicationShouldOpenUntitledFile:(NSApplication*)app
{
    return NO; // Don't open a blank document by default.
}

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSDocumentController *dc = [NSDocumentController sharedDocumentController];
NSArray *mru = [dc recentDocumentURLs];


    // Open most recent document if there is one.
    if ([mru count] > 0) {

NSURL *recent = [mru objectAtIndex: 0];
[dc reopenDocumentForURL:recent withContentsOfURL:recent error:nil];
}
}


Cheers,
Graham Perks.

Once again a new question came up which i wouldn't know how to go about
I have a huge datafile for my programm (Cocoa Document-based) which you now have to manually load by dropping it on the programm icon or by going to File-->Open


I would like to do this automaticly as i only have 1 datafile and it will never be more then that. So in my opnion it would be better if people can go straight through the content without having to manually load it everytime.

I want the file to be on one remote location (a http server) and everytime somebody starts the application it will download and read the content straight into my programm so thats its directly viewable in my NSTableView.

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Automatic opening of a DataFile at awakeFromNib?? (From: Bastiaan <email@hidden>)

  • Prev by Date: Re: Posting commands?
  • Next by Date: Re: Force binding to set variable?
  • Previous by thread: Automatic opening of a DataFile at awakeFromNib??
  • Next by thread: Getting progress of HTTP POST as it's being UPLOADED
  • Index(es):
    • Date
    • Thread