Subclassing NSColorWell?
Subclassing NSColorWell?
- Subject: Subclassing NSColorWell?
- From: Mike McNamara <email@hidden>
- Date: Thu, 14 Jul 2005 15:11:31 -0600
Hello!
I'm attempting (without much luck unfortunately) to attach an
NSString to the drag data coming out of an NSColorWell. As an
NSColorWell otherwise does and provides most everything else I
require, I thought that I'd avoid reinventing the wheel and subclass
NSColorWell for my purposes. I've simply attempted to override both
the mouseDown and mouseDragged methods in my subclass of NSColorWell:
//-----//
- (void) mouseDown:(NSEvent *)event {
BOOL worked;
[super mouseDown: event];
NSPasteboard *pb = [NSPasteboard pasteboardWithName: NSDragPboard];
[pb declareTypes:[NSArray arrayWithObjects:NSStringPboardType,
nil] owner:self];
x = [pb setString: @"test String" forType: NSStringPboardType];
if (!worked) {
NSLog(@"couldn't setString on pb");
} else {
NSLog(@"%@", [pb stringForType: NSStringPboardType]);
}
}
//-----//
thinking that would suffice. Apparently that thinking is flawed! =)
I can see via NSLog that the string in fact arrives and is placed on
the dragging pasteboard. When I do a drag from the NSColorWell
however, there's no NSString being delivered to the destination.
Are there some other method(s) that needs to be overridden in this
instance? Perhaps I'm missing some important point entirely? I
could create my own NSView or NSControl and implement the appropriate
dragging stuff, but it just seems silly as NSColorWell does 95% of
what I need.
Advice is much appreciated!
Mike
_______________________________________________
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