Add MenuItem into Open Recent
Add MenuItem into Open Recent
- Subject: Add MenuItem into Open Recent
- From: Song-Bin Lin <email@hidden>
- Date: Tue, 24 Feb 2004 03:31:16 +0800
Hi all,
I have a idea to improve my application more friendly by adding a
"Open All Recent" item. I hope this action can open all recent
documents which are show in Open Recent sub items. I expect my "Open
All Recent" item can insert into the first index that users can easy
understand what is this function. Unfortunate, I can. I add the menu
item during -applicationDidFinishLaunching: of the delegate of the
application for example:
- (void) applicationDidFinishLaunching:(NSNotification*) aNotification
{
int nIndex = [m_menuFile indexOfItemWithTarget:nil
andAction:@selector(openDocument:)];
if (nIndex >=0)
{
if(NSMenu* menuOpenRecent = [[m_menuFile itemAtIndex:nIndex+1]
submenu])
{
[menuOpenRecent insertItemWithTitle:@"Open All Recent"
action:@selector(fileOpenRecentAllRecent:) keyEquivalent:[NSString
string] atIndex:0];
[menuOpenRecent insertItem:[NSMenuItem separatorItem] atIndex:1];
}
}
}
After launching the application, the Open Recent sub menu is the same
as before never change. I only see the recent documents and "Clear
Menu".
If I use addItme to replace insertItem, the Open Recent is changed. I
can see the recent documents and "Open All Recent" but "Clear Menu"
disappears. Do I miss any thing?
lsb. 04.02.24.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.