Re: Dynamic menu for document-based app?
Re: Dynamic menu for document-based app?
- Subject: Re: Dynamic menu for document-based app?
- From: Yann Bizeul <email@hidden>
- Date: Wed, 19 Jan 2005 00:35:39 +0100
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.
Unfortunately, I don't know If you have the choice :-/
Perhaps you could redesign some parts of your app to make this kind of
operation more centralized, and avoid repeating code to update your
menu.
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.bclass
The documentation says a menu with a nil target will send the message
down the responder chain. So you just have to set an action to your
menu item (setAction:) and let the responder chain go to your
NSDocument subclass :
From
file:///Developer/ADC Reference Library/documentation/Cocoa/
Conceptual/BasicEventHandling/Concepts/ActionEventMsg.html#//apple_ref/
doc/uid/20000897 :
[...]
In the case of an untargeted action message, where the target is nil,
sendAction:to:from: searches the full responder chain for an object
that implements the action method specified. If it finds one, it sends
the message to that object with the instigator of the action message as
the sole argument.
[...]
Regards,
--
Yann Bizeul - yann at tynsoe.org
Please use this e-mail when writing to me.
You can visit my projects at this address :
http://projects.tynsoe.org/
(BuddyPop - GeekTool - SSH Tunnel Manager...)
_______________________________________________
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