• 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: Multi-line NSTokenField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multi-line NSTokenField


  • Subject: Re: Multi-line NSTokenField
  • From: Marc Monguio <email@hidden>
  • Date: Tue, 23 May 2006 16:19:00 +0200

Sorry, in the previous mail I was missing setWraps:, which is the most important thing to make the words fit in sequential lines. I also misspelled the name of one variable...
The following code should work. If you encounter any problems just look into NSTextField documentation which is what a NSTokenField inherits from.


IBOutlet NSTokenField *tokenField;

- (void)awakeFromNib
{
[[seedsField cell] setWraps:YES];
}

//make your class delegate of the tokenField and implement the following method
- (void)controlTextDidChange:(NSNotification *)aNotification;
{
[self resizeTokenField];
}


//This implements the live resizing
- (void)resizeTokenField;
{
NSRect oldTokenFieldFrame = [tokenField frame];
NSSize cellSize= [[tokenField cell] cellSizeForBounds:[tokenField bounds]];
[tokenField setFrame:NSMakeRect(
oldTokenFieldFrame.origin.x,
oldTokenFieldFrame.origin.y+ oldTokenFieldFrame.size.height- cellSize.height,
oldTokenFieldFrame.size.width,
cellSize.height)];
}
_______________________________________________
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
References: 
 >Multi-line NSTokenField (From: Graham <email@hidden>)
 >Re: Multi-line NSTokenField (From: Marc Monguio <email@hidden>)

  • Prev by Date: Re: KVO question
  • Next by Date: Menu and views
  • Previous by thread: Re: Multi-line NSTokenField
  • Next by thread: Bug in PDFKit's PDFDocument attributes?!
  • Index(es):
    • Date
    • Thread