Re: NSSegmentedControl subclass and bindings
Re: NSSegmentedControl subclass and bindings
- Subject: Re: NSSegmentedControl subclass and bindings
- From: Dorian Johnson <email@hidden>
- Date: Fri, 29 Jun 2007 12:10:46 -0500
I understand how bindings work---not completely, so if there's a
specific area that I'm missing I'd appreciate someone pointing it
out---but please don't throw me to the beginning tutorials. I did,
however, read through that and your "Cocoa Bindings in a Nutshell",
mmalc.
The reason this I'm having problems is because I don't know how I'm
supposed to throw the change event for this specific control.
For example,
[self setValue:[NSNumber numberWithInt:newSelectedSegment]
forKey:@"selectedIndex"];
doesn't work, because NSSegmentedControl isn't KVC compatible for
selectedIndex, hence my confusion. Setting selectedSegment via
setValue:forKey: works but doesn't fix the bindings problem.
On Jun 29, 2007, at 5:18 AM, mmalc Crawford wrote:
On Jun 28, 2007, at 11:41 PM, Dorian Johnson wrote:
I have a custom NSSegmentedControl that has non-standard width,
thus, I'm subclassing mouseDown and mouseUp to select the proper
segment. This works fine, but now I need to use bindings with the
selectedIndex property. I can't get it to work at all, though...
any pointers?
Here's my mouseUp method:
unsigned newSelectedSegment; // assume this is calculated and valid
[self willChangeValueForKey:@"selectedSegment"];
[self setSelectedSegment: newSelectedSegment];
[self didChangeValueForKey:@"selectedSegment"];
I've tried using willChangeValueForKey with selectedIndex but that
did nothing to resolve the problem. Any tips on how to get my
subclassing behaving with bindings?
This general issue has come up several times in the past week or so.
See recent archives and <http://developer.apple.com/documentation/
Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html>
mmalc
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden