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

Fwd: [SOLVED] custom field editor, no focus ring, no select all


  • Subject: Fwd: [SOLVED] custom field editor, no focus ring, no select all
  • From: Nick Rogers <email@hidden>
  • Date: Fri, 30 Aug 2013 21:18:08 +0530

Hi,

Now I'm using a NSTextField instead of NSTexView.

Best,
Nick

Begin forwarded message:

> From: Nick Rogers <email@hidden>
> Subject: custom field editor, no focus ring, no select all
> Date: 30 August 2013 8:23:12 PM IST
> To: Cocoa-dev List List <email@hidden>
>
> 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

_______________________________________________

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


References: 
 >custom field editor, no focus ring, no select all (From: Nick Rogers <email@hidden>)

  • Prev by Date: custom field editor, no focus ring, no select all
  • Next by Date: Finding column of just edited nstableview cell
  • Previous by thread: custom field editor, no focus ring, no select all
  • Next by thread: Finding column of just edited nstableview cell
  • Index(es):
    • Date
    • Thread