NSTokenField how to make it horizontally scrollable
NSTokenField how to make it horizontally scrollable
- Subject: NSTokenField how to make it horizontally scrollable
- From: Client netplus <email@hidden>
- Date: Thu, 01 Nov 2007 07:32:33 +0100
Hi,
Is there anyone who can tell me how to make an NSTokenField(2 line height), included in a
NSScrollView horizontally scrollable.
I tried to use this delegate method:
- (void)controlTextDidChange:(NSNotification *)aNotification;
and used this code:
NSRect frame;
float width = 0.0;
float height = 0.0;
NSRect oldTokenFieldFrame = [locationTokenField frame];
NSSize cellSize= [[locationTokenField cell] cellSizeForBounds:[locationTokenField
bounds]];
frame = NSMakeRect(oldTokenFieldFrame.origin.x,
oldTokenFieldFrame.origin.y+oldTokenFieldFrame.size.height-cellSize.height,
oldTokenFieldFrame.size.width,
cellSize.height);
width = fmaxf(width, NSWidth(frame));
height = fmaxf(height, NSHeight(frame));
frame.size.width += 10.0;
[locationTokenField setFrame:frame];
NSScrollView *scrollView = [locationTokenField enclosingScrollView];
[scrollView setAutoresizingMask:NSViewHeightSizable];
[scrollView setHasVerticalScroller:YES];
[scrollView setHasHorizontalScroller:NO];
frame = [[scrollView documentView] frame];
frame.size.width = width;
frame.size.height = height;
[[scrollView documentView] setFrame:frame];
[scrollView setNeedsDisplay:YES];
But i couldn't accomplish what i was looking for ;-(
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden