Shrink NSScroller from NSScrollView in layer-enabled mode

I'm having a strange problem (error?): Let's say I have WebView

one that will scroll vertically.

Now I want to shrink the vertical scroller a little mainFrame

so that its height is less than itself NSScrollView

.

enter image description here

The reason for this is that I want to display two views (top and bottom) above the webview.

I made it easy in the frameLoad delegate method by changing the verticalScroller frame (changing the start and height).

It works, but:

However, as soon as I installed the webView and its parent NSView is layer-enabled , it stops working, the scroller resets itself to default and height.

Now I don't know if this is a bug or not. Is there any other way I could try to "insert" the scroller?

+1


source to share


1 answer


Have you tried subclassing NSScroller by setting it as a vertical scroller for your NSScrollView and overriding

-(void) setFrameOrigin:(NSPoint)origin;
-(void) setFrameSize:(NSSize)size;

      

My guess is that creating layer-aware NSView support is based on the frameSize being set again (NSScrollView seems to have quite a bit of control over this, because when you create your own scroller, there is no "clean" way to set the NSScroller to be horizontal or vertical. other than calling -initWithFrame: with



  • height> width to automatically set it to be vertical
  • width> height to automatically set it as horizontal

My other suggestion would be, if you want the NSScroller not to fully reflect the size of its parent NSScrollView, you'd be better off having the NSView as a view of the web browser content. And NSView has 3 subheadings. Two top and bottom views are docked, and one NSScrollView is in the middle. In this case, no NSScroller is required.

+2


source







All Articles