Re: Focus ring changed
Re: Focus ring changed
- Subject: Re: Focus ring changed
- From: "Erik M. Buck" <email@hidden>
- Date: Mon, 15 Nov 2004 19:30:54 -0500
<Quote>
applicationDidUpdate:
- (void)applicationDidUpdate:(NSNotification *)aNotification
Sent by the default notification center immediately after the NSApplication
object updates its NSWindows. aNotification is always an
NSApplicationDidUpdateNotification. You can retrieve the NSApplication
object in question by sending object to aNotification.
See Also: – applicationWillUpdate:, – updateWindows
<End Quote>
Implementing the -applicationDidUpdate: delegate method is sometimes used to
validate menu items, inspector panels ("get info panels"), buttons, etc.
user focus changes. For example, implement -applicationDidUpdate: to send a
message up the responder chain via - (BOOL)sendAction:(SEL)anAction
to:(id)aTarget from:(id)sender and/or use -
(id)targetForAction:(SEL)aSelector to find out who the recipient of the
action would be. Then validate the inspector panel or button or whatever
based the result of the message or who the recipient would be.
This technique is nice because it works flexibly in situations where there
are many diverse cases when a user interface is valid and many diverse cases
when it isn't. It decouples user interface components from each other and
works automatically when the user interface is changed or expanded. For
example, if there is a color well on an inspector panel, the color well
might be enabled any time an object that implements the -takeColorFrom:
method is in the responder chain and disabled otherwise.
Implement -applicationDidUpdate: to call
-targetForAction:@selector(-takeColorFrom:), and if the retuned value is not
nil, enable the color well. Otherwise disable the color well. Later on,
when another user interface object that implements -takeColorFrom: is
invented, the existing code will continue to work as expected with the new
object.
This is basically how automatic menu validation works already.
_______________________________________________
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