Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTokenField how to make it horizontally scrollable



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.