I created an IB plug-in with a subclass of NSView with an exposed bind of type 
NSNumber, and then I bind it to a MyNSImageView through an NSObjectController 
(this is made directly in IB).

In source code of the class myclass.h:

@interface AnotherClass : NSView {
        NSNumber *type;
}

-(NSNumber *)type;
-(void)setType:(NSNumber *)value;
@end

@interface MyClass  : NSView{
        AnotherClass *anotherClass;
...
}

-(NSNumber *)type;
-(void)setType:(NSNumber *)value;
...
@end

In source code of the class myclass.m:

@implementation AnotherClass

-(NSNumber *)type {return type;}
-(void)setType:(NSNumber *)value  {type = value;}

@end

@implementation MyClass

+ (void)initialize
{
    if (self == [MyClass class])
    {
        [NSObject exposeBinding:@"type"];
    }
}

-(NSNumber *)type {
        return [anotherClass type];
}

-(void)setType:(NSNumber *)value {
        [anotherClass setType:value];
        [self setNeedsDisplay:true];
}:


-(void)setSelectedIndex:(NSNumber *)value {
        ...//get the right inner class: anotherClass = ...;
        [self setValue:[anotherClass type] forKey:@"type"];
        [self setNeedsDisplay:true];
}
@end

And in MyNSImageView.h:

@interface MyNSImageView : NSImageView {
        NSNumber *type;
}
-(NSNumber *)type {return type;}
-(void)setType:(NSNumber *)value {type = value;}
@end

Now, everything works fine, except that when the method setSelectedIndex: from 
MyClass is called the bound NSImageView doesn't receive any change notification.
Can anyone tell me why?

Thank you all in advance.
Best regards,
livio. _______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to