• 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: Custom NSTextField Cell
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom NSTextField Cell


  • Subject: Re: Custom NSTextField Cell
  • From: SA Dev <email@hidden>
  • Date: Tue, 2 Aug 2005 15:54:17 -0400


How about on awakeFromNib, you tell your text field - setCell:myCustomCellInstance ... ?




On Aug 2, 2005, at 3:44 PM, Todd Yandell wrote:

Hi,

This seems like it would be easy, but I can't find anything on it. Here's what I want to do: I have a subclass of NSTextFieldCell that draws itself a little differently that the standard one. I want to embed it in an NSTextField, but Interface Builder doesn't have any way to do this. I subclassed the NSTextField itself, too, but of course it only gets an initWithCoder: message when it's pulled out of the nib, and I have no way of specifying that it uses my cell instead of the default NSTextFieldCell.

So, in short, how do I tell NSTextField to use my cell instead of the default one?

Right now I'm using the code below. It seems like it's a pretty bad hack, but it does seem to work. If there's no simple way to substitute a control's cell for another, what do you think of this? Is there anything wrong or dangerous with it?

(This code comes from my NSTextField subclass):

- (id)initWithCoder:(NSCoder *)coder
{
    [(NSKeyedUnarchiver *)coder setClass:
        [AOEditLabelCell class] forClassName:@"NSTextFieldCell"];
    return [super initWithCoder:coder];
}

Thanks,
Todd
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40silentalcove.net


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Custom NSTextField Cell
      • From: Todd Yandell <email@hidden>
References: 
 >Custom NSTextField Cell (From: Todd Yandell <email@hidden>)

  • Prev by Date: Piano keyboard control?
  • Next by Date: Re: Piano keyboard control?
  • Previous by thread: Custom NSTextField Cell
  • Next by thread: Re: Custom NSTextField Cell
  • Index(es):
    • Date
    • Thread