• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTabView; How to get the current / active tab ..?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTabView; How to get the current / active tab ..?


  • Subject: Re: NSTabView; How to get the current / active tab ..?
  • From: Scott Andrew <email@hidden>
  • Date: Sun, 7 Jun 2009 18:36:46 -0700

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 (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

_______________________________________________

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


  • Follow-Ups:
    • Re: NSTabView; How to get the current / active tab ..?
      • From: Andy Lee <email@hidden>
References: 
 >NSTabView; How to get the current / active tab ..? (From: Martin Batholdy <email@hidden>)

  • Prev by Date: Re: Using non-id sender in IBAction methods
  • Next by Date: Re: How to detect a click on app's dock icon (when the app is active)?
  • Previous by thread: NSTabView; How to get the current / active tab ..?
  • Next by thread: Re: NSTabView; How to get the current / active tab ..?
  • Index(es):
    • Date
    • Thread