Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8148247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:36:41+00:00 2026-06-06T14:36:41+00:00

I’d like to have a text field like the expression editor text field in

  • 0

I’d like to have a text field like the expression editor text field in Numbers:

enter image description here

It’s very similar to NSTokenField, but NSTokenField only supports a delimiter separated list of tokens, like the “To:” field in Mail.app.

enter image description here

I have to embed these tokens into the text at specific locations, but otherwise have them work exactly like NSTokenField (backspace deletes a token, you can drag them around etc.).

Is there any 1st or 3rd party control that does something like this? I didn’t find anything.

If not, how would you recommend implementing it? Use Core Text and reinvent the wheel (implement NSTextField with better token support)? Or is there a better solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:36:42+00:00Added an answer on June 6, 2026 at 2:36 pm

    I don’t think there is a alternative control available for NSTokenField (well, I could not find one either a couple of weeks ago).

    A possible option might be to follow the solution presented in Apple’s sample project LayoutManagerDemo. This shows a subclass of NSTextView capable of detecting mouse movement over the text. Install and run the demo to get the basic idea.

    The sample uses NSLayoutManager to detect mouse movement however the code could probably be adapted to detect specific character sequences in the text, like the tokens in your text field. Once you have the tokens and their location from NSLocationManager, you can insert your own representation based on the characteristics of your token. A possible solution could be to use NSTextAttachmentCell which will become a glyph inside your text. The benefit of using NSTextAttachmentCell is that it’s treated as a glyph by Cocoa’s text system (you can select it, it follows formatting etc.). By implementing drawWithFrame:inView: you can add the various visible attributes of each token.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a French site that I want to parse, but am running into
I have a text area in my form which accepts all possible characters from
I have a reasonable size flat file database of text documents mostly saved in
I have some data like this: 1 2 3 4 5 9 2 6
I have a bunch of posts stored in text files formatted in yaml/textile (from
I would like to count the length of a string with PHP. The string
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.