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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:04:53+00:00 2026-05-18T10:04:53+00:00

I use CoreData for a Mac application which runs under 10.5 and higher. The

  • 0

I use CoreData for a Mac application which runs under 10.5 and higher. The content of an entity (text attribute) will be displayed in an NSTextView through bindings. The user can edit the text there.

When I try to save the managed object context, the mouse cursor disappears from the text view and the text view scrolls up to the top.

How can I prevent CoreData/binding to do this because it’s annoying for the user to lose the focus!

Edit: Added the solution as a separate answer to mark the question as completed!

  • 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-18T10:04:54+00:00Added an answer on May 18, 2026 at 10:04 am

    I just found a solution for this problem. Before saving the managed object context I save the “state” (selected range and scroll position) of the text view

    NSRange selectedRange   = [self.textView selectedRange];
    NSScrollView* scrollView    = [self.textView enclosingScrollView];
    
    // get the current scroll position of the document view
    NSPoint scrollPosition = [[scrollView contentView] bounds].origin;
    

    after saving my entities I restore the selected range and scroll position

    [self.textView setSelectedRange:selectedRange];
    
    // restore the scroll location      
    [[scrollView contentView] scrollToPoint: scrollPosition];
    [scrollView reflectScrolledClipView: [scrollView contentView]];
    

    I found 2 possible solution to set the scroll position of a scroll view

    • Apple documentation about NSScrollView
      which does not work for me
    • Quickies about Scrolling an NSScrollView programatically which works!
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can people give me examples of why they would use coreData in an application?
I like to use CoreData and their entity model into my projects. I need
I am trying to use CoreData in a non-document based (single-coordinator) application. I've searched
I have an iOS application where I use coreData to store my documents. They
I created a project for iPad which uses Apple's Use CoreData template. I customized
I have to use CoreData based database to store my data. At high-level my
I'm working on my first RestKit app, and I use CoreData for local caching.
I have some NSManagedObject classes created for use with CoreData I need to add
I am doing a project which involves a good use of core data. I
I am trying to install OpenCV on my Mac (OS X v10.6.3) for use

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.