• 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: overriding the initialiser of a NSTextfield subclass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: overriding the initialiser of a NSTextfield subclass


  • Subject: Re: overriding the initialiser of a NSTextfield subclass
  • From: Michael Gersten <email@hidden>
  • Date: Thu, 18 Jul 2002 01:45:46 -0700

If you are creating your window in your code, this will work -- initWithFrame: will be called at run time.

But if your window is created in your nib, then IB has sent the initWithFrame: at window creation time (nibs are real freeze-dried objects, not just "here's how to recreate the object").

In that case, you need to override awakeFromNib instead.

Graeme Nattress wrote:
> I want to override the initialiser of a subclass of NSTextfield, so I
> can put some initial text in there, and set it up for recieving a
> drag. This is what I've tried:
>
> #import "RibPathField.h"
>
> @implementation RibPathField
> - initWithFrame:(NSRect)frame
> {
> [super initWithFrame:frame];
>
> [self registerForDraggedTypes:
> [NSArray arrayWithObject:NSStringPboardType]];
>
> [self setObjectValue:@"Drop file here"];
> NSLog(@"here");
> return self;
> }
> @end
>
> But it doesn't even seem to execute that code. Can anyone help?
>
> Graeme
> --
> --
> Graeme Nattress: Vice President R&D www.noitaminanimation.com
> _______________________________________________
> 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.

--
I am a Mac OS X-Cocoa/WOF/EOF developer, and I'm available for hire. Please contact me at michael-job @ stb.nccom.com if interested. Resume at http://resumes.dice.com/keybounce
_______________________________________________
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.

References: 
 >overriding the initialiser of a NSTextfield subclass (From: Graeme Nattress <email@hidden>)

  • Prev by Date: Re: How to determine when printing an NSView ?
  • Next by Date: Re: Re(2): [Seriously OT]Mac.com 60 days and counting
  • Previous by thread: overriding the initialiser of a NSTextfield subclass
  • Next by thread: set/saveFrameUsingName
  • Index(es):
    • Date
    • Thread