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

The Archive Base Latest Questions

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

I have two NSScrollView’s with scroll synchronized with each other (using Apple’s example )

  • 0

I have two NSScrollView’s with scroll synchronized with each other (using Apple’s example) and it is working. Next I implemented a zoom that would zoom both images (they have the same size by definition). The code for the zoom was adapted using code from here, which I present here:

    if (oldZoomValue > [sender floatValue]) // then we are zooming in
{
    float zoomFactor = 1 + oldZoomValue - [sender floatValue];

    oldZoomValue = [sender floatValue];

    NSRect visible = [synchroS_ScrollView documentVisibleRect];
    NSRect newrect = NSInsetRect(visible, NSWidth(visible)*(1 - 1/zoomFactor)/2.0, NSHeight(visible)*(1 - 1/zoomFactor)/2.0);
    NSRect frame = [synchroS_ScrollView.documentView frame];

    [synchroS_ScrollView.documentView scaleUnitSquareToSize:NSMakeSize(zoomFactor, zoomFactor)];
    [synchroS_ScrollView.documentView setFrame:NSMakeRect(0, 0, frame.size.width * zoomFactor, frame.size.height * zoomFactor)];
    [[synchroS_ScrollView documentView] scrollPoint:newrect.origin];

    NSRect visibleI = [synchroI_ScrollView documentVisibleRect];
    NSRect newrectI = NSInsetRect(visibleI, NSWidth(visibleI)*(1 - 1/zoomFactor)/2.0, NSHeight(visibleI)*(1 - 1/zoomFactor)/2.0);
    NSRect frameI = [synchroI_ScrollView.documentView frame];

    [synchroI_ScrollView.documentView scaleUnitSquareToSize:NSMakeSize(zoomFactor, zoomFactor)];
    [synchroI_ScrollView.documentView setFrame:NSMakeRect(0, 0, frameI.size.width * zoomFactor, frameI.size.height * zoomFactor)];

    [[synchroI_ScrollView documentView] scrollPoint:newrectI.origin];
}
else
{
// the equivalent but for zoom-out
}

If I use the zoom functionality without synchronized Scroll’s, both images on the NSScrollView are zoomed nicely as expected. However, if they are synchronized, the program crashes with it seems to be a stack of several calls: on the main thread, it shows a lot of things like

#18 0x0000000100003e37 in -[SynchroScrollView synchronizedViewContentBoundsDidChange:] ()

and on the GDB:

This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys000
sharedlibrary apply-load-rules all
[Switching to process 33162 thread 0x0]
[Switching to process 33162 thread 0xac03]
[Switching to process 33162 thread 0x903]
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
...
(gdb)

Can anyone point me a direction for debug or have any idea what is happening?
Thank you for your help.

  • 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-26T19:41:06+00:00Added an answer on May 26, 2026 at 7:41 pm

    I’m not sure where you call the code for zooming the scrollView, but maybe zooming in scrollView A triggers zooming in scrollView B, which in turn triggers zooming in scrollView A again, creating an endless loop. changing the bounds in the synchronizedViewContentBoundsDidChange method would call the same method again and again.

    I know this question is a few months old, but maybe this helps 🙂

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

Sidebar

Related Questions

I have two applications written in Java that communicate with each other using XML
I have two classes which depend on each other. I've solved this problem before
I have two arrays of animals (for example). $array = array( array( 'id' =>
I have two instances of NSScrollView both presenting a view on the same content.
Have two sets of data (two tables) for patient records, one 1999-2003, the other
I have two grids with three rows each. The first and last row of
I have two classes that extend the activity class. Each class has it's own
I have two algorithms of finding primes, in Python. The inner loop of each
I have two relative layouts that are currently displayed one below the other. I
Have two folders with approx. 150 java property files. In a shell script, how

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.