• 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
Repositioning an NSTextFieldCell?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Repositioning an NSTextFieldCell?
      • From: Daniel Jalkut <email@hidden>
  • Prev by Date: Re: How can I get an instance specific identifier?
  • Next by Date: Re: How do I give a set of methods to some objects but not others?
  • Previous by thread: Re: How can I get an instance specific identifier?
  • Next by thread: Re: Repositioning an NSTextFieldCell?
  • Index(es):
    • Date
    • Thread