Re: Multi-line NSTokenField
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