How do I scroll a NSScrollViewMBS to the bottom? I’m using the example with the containers in a list.
ScrollView.contentView.scrollToPoint does something. But to which point do I need to scroll?
ScrollView.scrollToEndOfDocument makes an exception: A Cocoa NSInvalidArgumentException was not handled: -[NSScrollView scrollToEndOfDocument:]: unrecognized selector sent to instance 0x7fda020b2a00
Xojo 2024r1, MBS 24.3.
The contentSize property should give you the size of the scrolled view.
If it helps I could of course add some more methods there.
Like this?
Dim newOrigin As New NSPointMBS(0, ScrollView.contentSize.Height)
ScrollView.contentView.scrollToPoint newOrigin
The result is weird:
Without the new code:
@Christian_Schmitz : any idea how to solve the scrolling problem?
There is also a second problem I need to fix. I set the scrollbar to autohide:
ScrollView.autohidesScrollers = True
But as you can see in the screenshot above the scrollbars always show. The inner container always is a couple of pixels higher than the full “listbox”.
I don’t find something with current plugins, but I can add new methods for next plugins:
// scroll to bottom
ScrollView.documentView.scrollPoint 0, 0
// scroll to top
ScrollView.documentView.scrollPoint 0, ScrollView.documentView.frame.Height-ScrollView.frame.Height
1 Like
Thanks, oh, the coordinates are Cocoa ones. The scrolling works, but I get redraw issues. If I add 10 items in the original example and resize the window I get the following:
In my code I get the following result:
Sorry, not sure what happens there.
Seems to work here:
// scroll to bottom
dim s as NSScrollViewMBS = TestControl.ScrollView
s.documentView.scrollPoint 0, 0
The scrolling itself works fine. But I get redraw issues as shown in the screenshots above.