Open Recent getting to work

  • I've been reading up on different threads for how to get Open Recent
    to work, but I'm still not getting it to work in my App.  From what
    I've found on the internets, I have put together the following
    notification method for my NSApplication:

    - (void)applicationWillFinishLaunching:(NSNotification *)aNotification
    {
    NSMenu *main_menu = [NSApp mainMenu];
    id file_menu = [[main_menu itemWithTitle: @"File"] submenu];
    id open_rect_menu = [[file_menu itemWithTitle: @"Open Recent"] submenu];
    [open_rect_menu performSelector:@selector(_setMenuName:)
    withObject:@"NSRecentDocumentsMenu"];
    }

    supposedly this last line should do the trick, but it doesn't seem to
    do anything.  I have a nib file which I setup in interface builder to
    trigger a function in a custom NSResponder when File > Open is
    selected.  Somehow I'd like the results of this operation to populate
    the Open Recent menu if a file is actually opened, but I am a bit lost
    in the intricacies of how this should happen.  Any ideas?

    thanks,
    wes
  • Ok, sorry for the noise.  I finally found what I was looking for in this thread:

    http://lists.apple.com/archives/Cocoa-dev/2004/Jul/msg01113.html

    [[NSDocumentController sharedDocumentController]
    noteNewRecentDocumentURL: [NSURL URLWithString: file]];

    best,
    wes
previous month december 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