• 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: Using Subclasses with Standard Classes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using Subclasses with Standard Classes


  • Subject: Re: Using Subclasses with Standard Classes
  • From: The Amazing Llama <email@hidden>
  • Date: Sat, 9 Aug 2003 18:44:30 -0700

Your code is being called when the tabView's -selectedTabViewItem is not a CustomTab. This is probably because the NSTabView contains a real NSTabViewItem, perhaps the default one that IB put in there. Check with isKindOfClass: or similar method to make sure -getMyObject safe to call, or make sure to -removeAllTabs from the NSTabView before you add some.

On Saturday, August 9, 2003, at 05:14 PM, Seth Willits wrote:

I'm having difficulty understanding how I would deal with this. I have a NSTabViewItem subclass, CustomTab which I dynamically create and add to a NSTabView. Later, I wish to retrieve the currently selected tab, and use a method specific to the CustomTab class. This was working until I changed the class using the code below from an NSTabView subclass to an NSObject subclass.

The error in the run log is that NSTabViewItem doesn't implement the selector "getMyObject", which of course it doesn't. How can I get get the TabViewItem returned by [tabView selectedTabViewItem] to act like the CustomTab object which it was originally created as?


- (MyObject *)currentObject
{
CustomTab * custTab = [tabView selectedTabViewItem];
return [custTab getMyObject];
}


- (CustomTab *)createNewTab
{
// Create new Tab
CustomTab * tab = [[CustomTab alloc] initWithIdentifier: @"My Custom Tab"];

...

// Editing the tab
[tab setLabel:@"New Tab"];
[tab setView: theView];

// Add to the TabView
[tabView addTabViewItem:tab];
[tab release];

return tab;
}




Seth Willits
----------------------------------------------------------------------- ----
President and Head Developer of Freak Software - http://www.freaksw.com
Q&A Columnist for REALbasic Developer Magazine - http://www.rbdeveloper.com
Webmaster for REALbasic Game Central - http://www.freaksw.com/rbgames

"You may laugh at me for chasing a dream, but I'll have the last laugh when I catch it."
-- Seth Willits
----------------------------------------------------------------------- ----
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.



Seth A. Roby The Amazing Llama < mail or AIM me at tallama at mac dot com>
"Life is like an exploded clown. It's really funny until you figure out what just happened."
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: Using Subclasses with Standard Classes
      • From: Seth Willits <email@hidden>
References: 
 >Using Subclasses with Standard Classes (From: Seth Willits <email@hidden>)

  • Prev by Date: Re: Passing FirstResponder calls to next responder
  • Next by Date: Java Bridge and javax.imageio.stream.ImageInputStream
  • Previous by thread: Using Subclasses with Standard Classes
  • Next by thread: Re: Using Subclasses with Standard Classes
  • Index(es):
    • Date
    • Thread