• 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
NSTokenField how to make it horizontally scrollable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: documentation for cross-version building?
  • Previous by thread: documentation for cross-version building?
  • Index(es):
    • Date
    • Thread