Open Recent Menu

  • In some situations, it is worthwhile to subclass NSDocumentController in non-NSDocument-based applications to get some of its features. For example, the NSDocumentController management of the Open Recent menu is useful in applications that don’t use subclasses of NSDocument.

    I have subclassed NSDocumentController.

    I have the Menu structure for there Open Recent menu.

    I use -noteNewRecentDocumentURL:

    Yet, I get no entries in the Menu.

    Where should I look?

    -koko

    code
    ===========
    in -windowDidLoad

        m_documentController = [[NSDocumentController alloc] init];
        [m_documentController retain];

    in my open action

        NSURL *url = [NSURL fileURLWithPath:path];
        [m_documentController noteNewRecentDocumentURL:url];
  • The URLs are returned by:

    -recentDocumentURLs

    They are just not in the menu.

    -koko

    On Jul 9, 2012, at 12:34 PM, koko wrote:

    > In some situations, it is worthwhile to subclass NSDocumentController in non-NSDocument-based applications to get some of its features. For example, the NSDocumentController management of the Open Recent menu is useful in applications that don’t use subclasses of NSDocument.
    >
    > I have subclassed NSDocumentController.
    >
    > I have the Menu structure for there Open Recent menu.
    >
    > I use -noteNewRecentDocumentURL:
    >
    > Yet, I get no entries in the Menu.
    >
    > Where should I look?
    >
    > -koko
    >
    >
    > code
    > ===========
    > in -windowDidLoad
    >
    > m_documentController = [[NSDocumentController alloc] init];
    > [m_documentController retain];
    >
    > in my open action
    >
    > NSURL *url = [NSURL fileURLWithPath:path];
    > [m_documentController noteNewRecentDocumentURL:url];
  • On 10/07/2012, at 4:34 AM, koko wrote:

    > In some situations, it is worthwhile to subclass NSDocumentController in non-NSDocument-based applications to get some of its features. For example, the NSDocumentController management of the Open Recent menu is useful in applications that don’t use subclasses of NSDocument.
    >
    > I have subclassed NSDocumentController.
    >
    > I have the Menu structure for there Open Recent menu.
    >
    > I use -noteNewRecentDocumentURL:
    >
    > Yet, I get no entries in the Menu.
    >
    > Where should I look?

    Emphasis on:

    >> useful in applications that ____don’t____ use subclasses of NSDocument

    Why are you doing this?

    This situation doesn't apply in your case. Just leave things as they are and the recent items menu will work normally.

    In any case the way you are creating your NSDocumentController is completely wrong. It must be done extremely early on in the launch of an app since it's a singleton instance that has to be available for all document objects that get created from the very first.

    The default NSDocumentController will work properly if you let it.

    --Graham
  • The problem was the menu, Open Recent.  This is not a NSDocument app and as such had no such menu. I created my own but not didi not get items.

    So, I added a new File menu from IB, dragged its OPen recent entry to my File menu, deleted the File menu just added.

    And now it all works.

    -koko

    On Jul 9, 2012, at 7:25 PM, Graham Cox wrote:

    >
    > On 10/07/2012, at 4:34 AM, koko wrote:
    >
    >> In some situations, it is worthwhile to subclass NSDocumentController in non-NSDocument-based applications to get some of its features. For example, the NSDocumentController management of the Open Recent menu is useful in applications that don’t use subclasses of NSDocument.
    >>
    >> I have subclassed NSDocumentController.
    >>
    >> I have the Menu structure for there Open Recent menu.
    >>
    >> I use -noteNewRecentDocumentURL:
    >>
    >> Yet, I get no entries in the Menu.
    >>
    >> Where should I look?
    >
    >
    >
    >
    > Emphasis on:
    >
    >>> useful in applications that ____don’t____ use subclasses of NSDocument
    >
    >
    > Why are you doing this?
    >
    > This situation doesn't apply in your case. Just leave things as they are and the recent items menu will work normally.
    >
    > In any case the way you are creating your NSDocumentController is completely wrong. It must be done extremely early on in the launch of an app since it's a singleton instance that has to be available for all document objects that get created from the very first.
    >
    > The default NSDocumentController will work properly if you let it.
    >
    >
    > --Graham
    >
    >
previous month july 2012 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