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

Use case: 3rd party application wants to programatically monitor a text file being generated
how can i use SQL statement in CoreData database ? which part of CoreData
I wrote an application which uses sqllite via coredata. It works fine on simulator
I make a distributed embedded application that will make use of several micro-controllers. The
I have an iOS application where I use coreData to store my documents. They
I have problems with my coredata sqlite DB, which hosts a book DB. After
I want to use a temp directory that will be unique to this build.
I'd like to use CoreData lightweight migration as much as possible, but could not
I'm wondering whether to use CoreData or simple sqlite database for an iOS app.
Short Question: Is there a way to tell CoreData to use COLLATE while creating

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.