Skip navigation.
 
mlRe: previous value of NSControl
FROM : Jens Alfke
DATE : Sat Mar 15 06:27:10 2008

On 14 Mar '08, at 6:20 PM, norio ota wrote:

> I set an action to a NSDatePicker and I'd like to know if an input 
> value , especially year component, is different from the year of its 
> previous date in the action method, without having a placeholder for 
> the previous value.


Use key-value observing (KVO). You can configure it to tell you the 
old as well as the new value.
It's all described in great detail in the documentation; read it 
carefully, because it gets quite tricky, though. For just this one 
case, it might be simpler just to store the previous value in an 
instance variable...

—Jens

Related mailsAuthorDate
mlprevious value of NSControl norio ota Mar 15, 02:20
mlRe: previous value of NSControl Jens Alfke Mar 15, 06:27