Why not use unique identifiers for each tab item? Each NSTabViewItem has an identifier value. Using that and some defines you can use do the following:

#define GENERAL_TAB 1
#define FONT_TAB 2

NSTabViewItem* tabViewItem = [tabView selectedTabViewItem];

switch([tabViewItem identifier])
{
        case GENERAL_TAB:
                NSLog(@"1");
                break;

        case FONT_TAB
                NSLog(@"2");
                break;
}


Scott


On Jun 7, 2009, at 11:14 AM, Martin Batholdy wrote:

hi,


I have an IBOutlet defined in my header;

IBOutlet NSTabView *tabView;


This Outlet is connected with a TabView generated with Interface Builder.

The TabView has two tabs,
and in my implementation file I want to do something when tab1 is active and something else when tab2 is active.

I tried the following;

        NSTabViewItem *tabViewItemX;
        tabViewItemX = [tabView selectedTabViewItem];

        if([tabViewItemX isEqualTo:[tabView tabViewItemAtIndex:0]]){
                NSLog(@"1");
        } else{
                NSLog(@"2");
        }

But it doesn't work properly. It is just always "2".

What do I wrong?



thanks!

_______________________________________________

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/scottandrew%40roadrunner.com

This email sent to scottand...@roadrunner.com

_______________________________________________

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