Metrics for a NSTextField
Metrics for a NSTextField
- Subject: Metrics for a NSTextField
- From: Eric Gorr <email@hidden>
- Date: Tue, 24 Feb 2009 15:13:17 -0500
I am attempting to get some measurements for the text being displayed
in a NSTextField and am running into trouble.
It looks like all of the measurement methods are related to NSTextView.
I tried asking for a NSTextView for my NSTextField by doing the
following:
NSTextView *fieldEditor = (NSTextView*)[[self window] fieldEditor:YES
forObject:self];
NSLog( @"fieldEditor: %@", fieldEditor );
NSRect usedRect = [[fieldEditor layoutManager]
usedRectForTextContainer:[fieldEditor textContainer]];
NSLog( @"usedRectForTextContainer: %@, %@",
NSStringFromRect( usedRect ), [self stringValue] );
But the used rect returned is empty and [self stringValue] does
contain a string of > 0 characters.
Is there something I am missing or is there an alternative way to get
the information I am 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