On Sep 20, 2008, at 4:53 AM, Alex Mills wrote:

Hey,

Yeah I have been reading through a bit of it. At the moment I have an NSArrayController setup in IB to access a Core Data Entity. A table view is then connected to that Array Controller to display the contents of it. This is all done without any code written by myself so I'm pretty new to working with these objects programatically. I need code that will recognize when the selection count of my table view changes, if that count is 0 it will display tab 1, if the selection count is 1 or more it will display tab 2. Right now I have an IBAction that will do this but requires me to press a button for the count check to be performed, what do you think would be the best way to implement this idea?

This is the IBAction:

-(IBAction)checkCount: sender;
{
        NSArray *selectedObjects = [propertyTableController selectedObjects];
        NSUInteger count = [selectedObjects count];
        if (count == 0)
        {
                [newTabView selectTabViewItemWithIdentifier:@"2"];
        }
        else
        {
                [newTabView selectTabViewItemWithIdentifier:@"1"];
        }       
        return;
}

Cheers
Alex Mills

You might want to look at the tableViewSelectionDidChange: delegate method of NSTableView. http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Classes/NSTableView_Class/Reference/Reference.html#/ /apple_ref/occ/instm/NSObject/tableViewSelectionDidChange:


--Nathan



_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to