Repositioning an NSTextFieldCell?
Repositioning an NSTextFieldCell?
- Subject: Repositioning an NSTextFieldCell?
- From: Joel Norvell <email@hidden>
- Date: Fri, 24 Nov 2006 13:59:14 -0800 (PST)
Dear Cocoa-dev People,
I'm creating a NSTextField. Its cell is aligned with the top of the field. As
a result of this, the text caret "smudges" the field's focus ring when editing.
It's a position problem, not a size problem; the field is large enough to
easily accommodate the text.
How could I reposition the NSTextFieldCell within its NSTextField to be closer
to the field's bottom? Is there any way to do this without subclassing
NSTextFieldCell and/or NSTextField?
If I do need to subclass NSTextField and/or NSTextFieldCell, a recipe/approach
suggesting pertinent overrides would be most appreciated!
I've scoured the list and combed the APIs meticulously; I'm chasing my tail on
this one.
Many thanks,
Joel
// This is how I'm creating the NSTextField:
- (void)makeWidgetTextfield:(NSView *)itsSuperview
{
NSTextField* newTextField = [[NSTextField alloc] initWithFrame:widgetRect];
[self setWidgetTextField:newTextField];
[itsSuperview addSubview:[self widgetTextField]];
[[self widgetTextField] setEditable:YES];
[[self widgetTextField] setBackgroundColor:[NSColor whiteColor]];
[[self widgetTextField] setDrawsBackground:NO];
[[self widgetTextField] setBordered:NO];
[[self widgetTextField] setNeedsDisplay:YES];
NSFont *font = [NSFont fontWithName:@"Courier" size:12.0];
[[self widgetTextField] setFont:(NSFont *) font];
[[[self widgetTextField] cell] setRefusesFirstResponder: NO];
[[[self widgetTextField] cell] setShowsFirstResponder:YES];
}
____________________________________________________________________________________
Sponsored Link
Mortgage rates near 39yr lows.
$510k for $1,698/mo. Calculate new payment!
www.LowerMyBills.com/lre
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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