Re: NSScrollView showing part of view with white space above

2019-10-13 Thread Aandi Inston via Cocoa-dev
No auto-layout, identical coordinate systems. I found the solution, which
is entirely my fault of course, thanks
to your comment "It sounds like your NSView actually has white space at the
top." For the benefit of future
readers of this thread, here is the solution.

I assumed the underlying (scrolled) NSView must be correct because it
always was correct when shown without
the NSScrollView. (The NSScrollView was added only if the window layout
would not fit on screen). But, the
window was created from coordinates that are top down (origin top left).
This has been managed before using
any Cocoa code by something like this:

  cocoa_y = window_interior_height - design_y

but of course, the window_interior_height is no longer interesting. I was
subtracting from too small a number,
and needed to be subtracting from the size assigned to the scrolled area.
So I really, really did have a
scrolled area with lots of white space at the top. Thank you for sending me
straight to the solution!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSScrollView showing part of view with white space above

2019-10-13 Thread Quincey Morris via Cocoa-dev
On Oct 13, 2019, at 06:30 , Aandi Inston via Cocoa-dev 
 wrote:
> 
> If the NSScrollView is scrolled upwards, the content in the window moves down 
> (as normal). What we now see is a large white space at the top of the 
> NSScrollView, and below that the same view portion we first saw.

It sounds like your NSView actually has white space at the top.

However, IB historically has a problem where its knowledge of the NSScrollView, 
the NSClipView and the client view gets messed up, and it mis-positions things 
rather than enforcing the correct relative positioning.

I think you have to start by logging the bounds of all three views (don’t 
forget the NSClipView!), but make sure you convert all of their coordinates to 
a *common* coordinate system (such as window coordinates), otherwise it can be 
too hard to compare them. Do this once initially, then again after you’ve 
scrolled all the way to the top.

You also haven’t mentioned whether your view is using auto-layout. Your view 
may be resizing to meet some auto-layout constraints, dumping all of your 
subviews at the bottom.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSScrollView showing part of view with white space above

2019-10-13 Thread Aandi Inston via Cocoa-dev
I have having a problem working with NSScrollView. The code is in pieces
all over
the desk at the moment, but I'm asking in case someone recognises the
symptoms,
before I reduce this to a simple test case.

An NSScrollView is made from an NSView containing various NSControls. The
NSView
is fine before the NSScrollView and, when the NSScrollView is shown, looks
fine.
It shows the top portion of the NSView, as expected.

But, the vertical scroll bar position is at the BOTTOM of the window. Now,
the
curious part starts. If the NSScrollView is scrolled upwards, the content in
the window moves down (as normal). What we now see is a large white space
at the
top of the NSScrollView, and below that the same view portion we first saw.

To put it another way, the NSView we scroll is a view containing white
space at
the top, and part of the original NSView below that. Yet all the rectangles
I
can find show (0,0) as the origin as I'd expect.

Note that this is NOT a question about how to make the scroll bar first
appear
at the top. If I use [myScrollView.contentView
scrollPoint:NSMakePoint(0,height)]
I get the same effect as dragging the scroll bar to the top.

Maybe ASCII art can explain

Complete NSView (to be scrolled)
+-
+
+  TOP LABEL
+
+  Explanation
+
+  [x] Check box
+
+  {Cancel} {OK}
+
+-

Initial NSScrollView (scroll bar shown at BOTTOM)
+-
+
+  TOP LABEL
+
+  Explanation
+
+  [x] Check box
+---

Effect of moving scroll bar to the top
+-
+
+
+
+
+  TOP LABEL
+
+---

Scrolling does not make the Cancel and OK buttons appear at all.

Thanks in advance!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com