Do CoreData validation methods get called for transient attributes?

  • Mine doesn't seem to be called ever. Here is the method for the
    NSManagedObject subclass that has a transient attribute "duration".
    Is this the correct signature?

    Dave

    // Validator for duration attribute.
    - (BOOL)validateDuration:(id*)ioValue error:(NSError**)error
    {
    if ([*ioValue doubleValue] > 2.)
    {
      *ioValue = [NSNumber numberWithDouble:2.];
    }

    return YES;
    }
  • On Nov 11, 2007, at 9:06 PM, Dave Fernandes wrote:

    > Mine doesn't seem to be called ever. Here is the method for the
    > NSManagedObject subclass that has a transient attribute "duration".
    > Is this the correct signature?
    >
    Yes, and yes.
    In your model, did you set the custom class for the entity?

    > // Validator for duration attribute.
    > - (BOOL)validateDuration:(id*)ioValue error:(NSError**)error
    > {
    > if ([*ioValue doubleValue] > 2.)
    > {
    > *ioValue = [NSNumber numberWithDouble:2.];
    > }
    > return YES;
    > }
    >
    You are strongly discouraged from modifying the value during validation.
    <http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Co
    ncepts/Validation.html#//apple_ref/doc/uid/20002173-169942-CJBHDJGC
    >

    mmalc
  • I forgot to check Validates Immediately under the value binding in
    IB. But one more question...

    On Nov 12, 2007, at 3:38 AM, mmalc crawford wrote:

    > You are strongly discouraged from modifying the value during
    > validation.
    > <http://developer.apple.com/documentation/Cocoa/Conceptual/
    > KeyValueCoding/Concepts/Validation.html#//apple_ref/doc/uid/
    > 20002173-169942-CJBHDJGC>
    >
    > mmalc
    >

    I'm a bit confused about this. In the reference above under
    "Implementing a Validation Method", outcome #2 is "A new object value
    that is valid is created and returned." Does the strong
    discouragement of this practice apply only to Core Data? In any case,
    is there a more appropriate place to coerce a value?

    Dave
  • Hi,

    I want to make a window that is always on the active space of Leopard
    spaces.
    It moves automatically to new active space when user changes the
    active space.

    It will be nice if the find panel had such a feature.

    Does anybody know how to make such a window?

    Satoshi
    -----------------------------------------------------
    Satoshi Matsumoto
    816-5 Odake, Odawara, Kanagawa, Japan 256-0802
  • On Nov 12, 2007, at 9:01 PM, æ…§ æ?¾æœ¬ wrote:

    > I want to make a window that is always on the active space of
    > Leopard spaces.
    > It moves automatically to new active space when user changes the
    > active space.
    >
    > It will be nice if the find panel had such a feature.
    >
    > Does anybody know how to make such a window?

    Satoshi,

    You may want to try calling setCollectionBehavior: with
    NSWindowCollectionBehaviorMoveToActiveSpace as a parameter.

    ___________________________________________________________
    Ricky A. Sharp        mailto:<rsharp...>
    Instant Interactive(tm)  http://www.instantinteractive.com
  • On 2007/11/13, at 12:17, Ricky Sharp wrote:
    >> I want to make a window that is always on the active space of
    >> Leopard spaces.
    >> It moves automatically to new active space when user changes the
    >> active space.
    >>
    >> It will be nice if the find panel had such a feature.
    >>
    >> Does anybody know how to make such a window?
    >
    >
    > Satoshi,
    >
    > You may want to try calling setCollectionBehavior: with
    > NSWindowCollectionBehaviorMoveToActiveSpace as a parameter.

    When setting the CollectionBehavior to
    NSWindowCollectionBehaviorMoveToActiveSpace,
    the window does not move automatically when user changes the active
    space.
    But it moves to the active space when the window is activated.

    It's enough solution for me.

    Thanks!!

    Satoshi
    -----------------------------------------------------
    Satoshi Matsumoto <satoshi...>
    816-5 Odake, Odawara, Kanagawa, Japan 256-0802
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today