Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSegmentedControl and Bindings




On Aug 30, 2005, at 6:10 AM, <email@hidden> <kyoso34- email@hidden> wrote:


I'm trying to bind either of the two segments in my
NSSegmentedControl object to a particular property in
NSArrayController each, namely canSelectNext:, to set
its enabled binding.

As I understand the documentation, the individual segments do not work as independent controls, and what you want to do cannot be done in IB alone. The problem must be addressed through the NSSegmentedControl. I subclassed NSArrayController, assigned the NSSegmentedControl target to a method of the array controller subclass, and within that method distinguished separate actions for the individual cells. Thus the array controller subclass has a method click:,


-(IBAction)click:(NSSegmentedControl*)sender
{
    int cell = [sender selectedSegment];
    if (cell == 0) {
        [self add:sender];
    } else {
        [self remove:sender];
    }
}

Tim Larkin
Abstract Tools
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >NSSegmentedControl and Bindings (From: <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.