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 7712891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:44:16+00:00 2026-06-01T01:44:16+00:00

I have a custom view with several NSTextField controls for which I want to

  • 0

I have a custom view with several NSTextField controls for which I want to supply custom auto-completions and I have successfully implemented all that using the NSTextFieldDelegate Protocol. The auto-completions are full names or place names, depending on which text field is being edited.

The issue is that the auto-completions almost always contain a space character and so if the user is typing something that matches a suggestion, but doesn’t want to accept that suggestion, the field editor will accept the suggestion when user presses the space key. I want the field editor to accept the suggestion using the tab key only.

I understand that this will involve subclassing NSTextView to provide a custom field editor, and this is documented by Apple as being the acceptable way, however it’s not clear to me what methods I need to override and what the overridden methods need to do, in order to get me what I want.

Can anyone suggest how this is achieved?

  • 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-01T01:44:17+00:00Added an answer on June 1, 2026 at 1:44 am

    I admit that I’d been fumbling with this question for quite some time earlier, before I discovered an acceptable answer via Google-fu. The magic code, blatantly stolen from the original answerer:

    @interface MLFieldEditor : NSTextView @end
    
    @implementation MLFieldEditor
    
    
    -  (void)insertCompletion:(NSString *)word forPartialWordRange:(NSRange)charRange movement:(NSInteger)movement isFinal:(BOOL)flag {
        // suppress completion if user types a space
        if (movement == NSRightTextMovement) return;
    
        // show full replacements
        if (charRange.location != 0) {
            charRange.length += charRange.location;
            charRange.location = 0;
        }
    
        [super insertCompletion:word forPartialWordRange:charRange movement:movement isFinal:flag];
    
        if (movement == NSReturnTextMovement)
        {
            [[NSNotificationCenter defaultCenter] postNotificationName:MLSearchFieldAutocompleted object:self userInfo:nil];
        } }
    
    @end
    

    (Additional reference)

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

Sidebar

Related Questions

I have several custom uibuttons on my view. I want to create a toggle
I have a custom view that contains several views in itself. I've made it
I have a LinearLayout view that already contains several elements. I want to add
I have a custom view that accepts drags. In the custom view there is
I have a custom view in my Android App that uses a ScaleGestureDetector.SimpleOnScaleGestureListener to
Please help me to turn off user interaction. I have a custom view which
I have a custom control/view that observes the direction of a gesture within its
I have a custom-made view that extends the View class. I would like 2
I have a simple custom view that is connected via outlet to a NIB.
I have a custom list view that is getting data from server and changing

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.