Dynamic menu for document-based app?
Dynamic menu for document-based app?
- Subject: Dynamic menu for document-based app?
- From: Keith Blount <email@hidden>
- Date: Tue, 18 Jan 2005 14:39:40 -0800 (PST)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Hello,
This might be really simple, but I would be very
grateful if anyone had any tips for the following
design idea I would like to add to my app:
I have a document-based app that uses an outline view
to display some hierarchical data. As an alternative
way of accessing this data, I would like to add a menu
to my app that displays the same data, much like the
bookmarks menu in Safari. (This makes sense in my app,
because the outline view is used to open and close
documents within the app.)
Creating the menu initially isn't a problem. I can use
my outline view's data source to build a menu
programmatically. But these are the problems I
foresee:
1) The menu would have to be updated every time the
datasource is changed.
2) The more difficult problem: the menu bar is for the
whole application, but this particular menu item
should show the data only for the currently active
document.
For 1), I guess I could use add notifications to every
data source method that changes data, but this seems
somewhat clunky. Or I could go through my code and
make sure the menu gets updated every time I call
reloadData on the outline view - again, a little
clunky, maybe.
For 2), the only thing that looked helpful in
NSApplication's documentation was maybe using [[NSApp
orderedDocuments] objectAtIndex:0] to work out which
data source to show in the menu, though I would have
thought there would be a better way... Also, I would
need to know whenever the active document changes.
If I am missing something really obvious here, my
apologies. But if anyone has any suggestions of how I
might most efficiently approach this, I would be
really thankful.
Many thanks in advance,
Keith
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
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