Scrollable Forms

I am trying to make an ‘inspector-like’ form that appears on the right hand side of a document (with splitter etc.) I want to load it with a set of labels and text field/check box/push button/etc. controls.
What kind of container should I use to place the labels and text fields on such that if the container is too small it can scroll (ideally automatically and I do not want to use a list box to contain the controls)? When I tried this with a ContainerControl there was no automatic scrolling nor any way to enablet scroll bars for the ContainerControl.

Assuming this is a desktop app (because Web is very easy to do this). You will have to have an overall container control for the ‘list’. This list container has the scrollbars and you have a second container that has the rows that you can then scroll up and down based on the scrollbar value. So the second container may (and will) be bigger than the first one and just moves up and down (if the scrollbars are visible).

Then, you’ll have a container ‘row’ that has the native controls you want/need. In reality this might be several different types of rows depending upon your usage needs. Once you have all the pieces then you have to put them together. I’ve done this is a few times and I think the minimum you can do it in is two containers types but I think it’s easier with three.

Bob, why can’t you just have the controls on the container and adjust the top property as you scroll to shift the controls up and down?

You can. Nothing stopping you from doing it that way.

I’m a lazy programmer. Why do it for each row when you can do it for one object and be done?

For some reason this results in jerky scrolling on OSX. The trick Bob mentioned works better.

No fair comment. That has made me think about how I am scrolling is perhaps a bit inefficient. Thanks bob. I’m not using controls, I paint all my controls in a source list but I scroll each one individually.

Thanks for the ideas Bob. I figured it out using a container control and a canvas. I was half way there when I wrote the first post but I was wondering if I was reinventing the wheel, you reply made me confident to continue and I ended up with a Canvas sub class that deals with the scrolling and turns on the scroll bar when required. It looked nice in Windows when I turned on double buffering but the form display would get corrupted so I have to put up with some flicker and no double buffering. As usual it all looks fine on the Mac… :-).

I did consider that approach but it just seemed so unnatural to have to loop through the controls and reposition them even though it is just as valid from the point of view of achieving scrolling. It does seem like a bit of a gap in the Xojo component list not to have a built in scrolling form for this kind of use and Canvas is a bit weird in that it doesn’t manage its scrolling state - but it wasn’t so difficult in the end.

In the ContainerControl webinar from earlier this week, I showed a project that had scrollable controls (DownloadContainer). The recording and demo projects are available here: