• 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
custom field editor, no focus ring, no select all
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

custom field editor, no focus ring, no select all


  • Subject: custom field editor, no focus ring, no select all
  • From: Nick Rogers <email@hidden>
  • Date: Fri, 30 Aug 2013 20:23:12 +0530

Hi,

I am using a custom field editor for a custom table view cell.

When ever I click on the name field the editor comes into view, but focus ring is not there and select all doesn't work when using keyboard or mouse or programmatically. I want the focus ring to be drawn and want to select all of the previous text so that the user can simply start typing a new name.

Here's the code snippet from the method doubleClickInTableView:


NSTextView *boxText = [[NSTextView alloc] initWithFrame:editRect];
NSTextContainer *textContainer = [boxText textContainer];

// Set up container
[textContainer setContainerSize:NSMakeSize(editRect.size.width, NSHeight([boxText frame]))];
[textContainer setWidthTracksTextView:NO];
[textContainer setHeightTracksTextView:NO];

// Set up size attributes
[boxText setHorizontallyResizable:YES];
[boxText setVerticallyResizable:NO];
[boxText setTextContainerInset:NSMakeSize(0, 2)];

// Set up editing attributes
[boxText setSelectable:YES];
[boxText setEditable:YES];
[boxText setFocusRingType:NSFocusRingTypeDefault];

// Set up rich text attributes
[boxText setRichText:NO];
[boxText setImportsGraphics:NO];
[boxText setUsesFontPanel:NO];
[boxText setUsesRuler:NO];

// Set up colors
[boxText setDrawsBackground:YES];
[boxText setBackgroundColor:[NSColor textBackgroundColor]];
[boxText setTextColor:[NSColor controlTextColor]];

[boxText setSelectedTextAttributes:aTitleAttributes];
// And most importantly...
[boxText setFieldEditor:YES];
[boxText setDelegate:self];

[sender addSubview:boxText];
[boxText display];
[boxText release];

[boxText setString:stringDisplayed];

[boxText sizeToFit];
[self.window makeFirstResponder:boxText];
[boxText drawFocusRingMask];
[boxText selectAll:self];

I have tried making boxText an ivar and allocating it in awakeFromNib, but still the same result.
Please help.

Thanks,
Nick
_______________________________________________

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


  • Follow-Ups:
    • Fwd: [SOLVED] custom field editor, no focus ring, no select all
      • From: Nick Rogers <email@hidden>
  • Prev by Date: Re: NSURL relativePath problem
  • Next by Date: Fwd: [SOLVED] custom field editor, no focus ring, no select all
  • Previous by thread: Re: NSURL relativePath problem
  • Next by thread: Fwd: [SOLVED] custom field editor, no focus ring, no select all
  • Index(es):
    • Date
    • Thread