Parent Container Scrollview

Hi, I have three, ContainerNotes parent containers, ContainerWindows son and the MyContainerCont container that is inside ContainerWindows

I need to show the Container Scroll ContainerWindows is like ContainerNotes’ child.

I’m using the Scrollview with ContainerControl example, it worked well inside a window but not inside another container.


const ExtraSpace = 600

// get the window
dim win as NSWindowMBS = self.NSWindowMBS
// and content view
dim contentView as NSViewMBS = win.contentView

// now get the view for the container
ContainerView = TestControl.NSViewMBS

// and it's original size
dim OutsideRect as NSRectMBS = ContainerView.frame

// make it higher
TestControl.Height = TestControl.Height + ExtraSpace

// get new size
dim InsideRect as NSRectMBS = ContainerView.frame

// remove view from window
ContainerView.removeFromSuperviewWithoutNeedingDisplay

// build new scrollview
ScrollView = new NSScrollViewMBS(OutsideRect.x, OutsideRect.y, OutsideRect.Width, OutsideRect.Height)

// customize it
ScrollView.hasVerticalScroller = true
ScrollView.verticalScrollElasticity = ScrollView.NSScrollElasticityAllowed

// use the container as document for the scrollview
ScrollView.documentView = ContainerView

// scroll to top
dim newOrigin as new NSPointMBS(0, ExtraSpace)
ScrollView.contentView.scrollToPoint newOrigin

// put scrollview in window
contentView.addSubview ScrollView


Image example

I have already solved it


const ExtraSpace = 600

// get the window
dim win as NSWindowMBS = self.NSWindowMBS
// and content view
dim contentView as NSViewMBS = win.contentView

// now get the view for the container
TestControl.ContainerView = TestControl.NSViewMBS

// and it's original size
dim OutsideRect as NSRectMBS = TestControl.ContainerView.frame

// make it higher
TestControl.Height = TestControl.Height + ExtraSpace

// get new size
dim InsideRect as NSRectMBS = TestControl.ContainerView.frame

// remove view from window
TestControl.ContainerView.removeFromSuperviewWithoutNeedingDisplay

// build new scrollview
TestControl.ScrollView = new NSScrollViewMBS(OutsideRect.x, OutsideRect.y, OutsideRect.Width, OutsideRect.Height)

// customize it
TestControl.ScrollView.hasVerticalScroller = true
TestControl.ScrollView.verticalScrollElasticity = TestControl.ScrollView.NSScrollElasticityAllowed

// use the container as document for the scrollview
TestControl.ScrollView.documentView = TestControl.ContainerView

// scroll to top
dim newOrigin as new NSPointMBS(0, ExtraSpace)
TestControl.ScrollView.contentView.scrollToPoint newOrigin

// put scrollview in window
contentView.addSubview TestControl.ScrollView



You can help me, I do not understand how to solve the following details.

The containerCont is set outside its container 1, when it is maximized it is not adjusted to the size of the window, also when the container change is not closed it remains in the window

The listbox can not be selected, can the scrollbar be improved? How much is it on the fields, it is not easy to go down, is it possible to add a visible bar? easier to navigate

I attach my project, it requires MBS Plugins

https://www.dropbox.com/s/hatpd1pcykrpx8n/ContainerControl.xojo_binary_project?dl=0