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

  • SEARCH
  • Home
  • 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 6718001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:55:06+00:00 2026-05-26T08:55:06+00:00

I’m trying to create a simple data entry application for the Mac (not iPhone).

  • 0

I’m trying to create a simple data entry application for the Mac (not iPhone).
It has an NSTableView (inside an NSScrollView) which contains an NSTextField into which the user keys data, line by line.

What I have so far is working okay, except that in order to actually be able to type anything into the text field, you have to press the ‘Enter’ key first. Then when you press the ‘Enter’ key at the end, the field leaves ‘edit’ mode, but the highlight just sits on the same row. Having to press ‘Enter’, ‘down arrow’, ‘Enter’ between each row of data entered is not very efficient.

What I would prefer is that when you press the ‘Enter’ key, the cursor moves down to the next row and the field is automatically placed into ‘edit’ mode.

I had thought that such a thing should be fairly straightforward, but I have been tearing my hair out all evening without any progress, and I still don’t even know which way I should be heading.

I tried looking for some attribute settings in the ‘inspectors’ in Xcode, but couldn’t see anything.

Searching online, suggestions seemed to keep coming back to somehow using First Responder. Playing around with this, I’ve only managed to get the blue highlight ring to move down around my TableView on demand, but this still doesn’t seem to put the text field into ‘edit’ mode nor move to another line.

Finally I found some information about subclassing and implementing your own textfields, but this seems like a very long and convoluted way to achieve this.

Can someone point me in the right direction as to how to do this?

Am I maybe using the wrong kind of control? Perhaps something else is more appropriate. Note that each line is distinct, so I don’t want things like word wrap etc.

  • 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-05-26T08:55:07+00:00Added an answer on May 26, 2026 at 8:55 am

    You were on the right track with the First Responder, but it’s important to not that text editing is handled by the window’s Field Editor (an instance of NSTextView), which becomes the first responder when text editing begins. The field editor informs its client (in this case your Table View) during editing.

    The easiest way to handle this would be to subclass NSTableView and override its textDidEndEditing: method. Something like this should get you started:

    - (void) textDidEndEditing:(NSNotification *)notification {
        [super textDidEndEditing:notification];
    
        int textMovement = [[notification.userInfo valueForKey:@"NSTextMovement"] intValue];
        if (NSReturnTextMovement == textMovement) {
    
            NSText *fieldEditor = notification.object;
    
            // The row and column for the cell that just ended editing
            NSInteger row = [self rowAtPoint:fieldEditor.frame.origin];
            NSInteger col = [self columnAtPoint:fieldEditor.frame.origin];       
    
            if (++col >= self.numberOfColumns) {
                col = 0;
                if (++row >= self.numberOfRows) return;
            }
    
            [self selectRowIndexes:[NSIndexSet indexSetWithIndex:row] 
                byExtendingSelection:NO];
            [self editColumn:col row:row withEvent:nil select:YES];
        }
    

    }

    This will progress left-to-right, top-to-bottom through the table’s columns and rows. Though you said you were using a NSTextField, I presume you meant you were using a NSTextFieldCell in a cell-based table. That’s another important distinction. If you’re not familiar with the concept of the field editor, I suggest you read up.

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace

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.