DesktopContainer Control - scrolling

I thought that if a container was larger than the size of its instance in a window, then we’d see some scroll bars?

I am confused, seeing older tutorials that have strange math.

My goal is to have a container of controls designed to edit the pieces of data for one row in a table, that’s smaller than the total space in the window.

The amount of data is more than a smaller screen would allow, so I have to account for end-users who do NOT have giant monitors like I do.

Any insight is greatly appreciated!

Far as I know only the Listbox does that - if you enable the scrollbars. Otherwise you have to put each control on a canvas of its own and then scroll the canvas with a scrollbar. If you want controls to move around as the window is resized, or shrink, you have to manage that yourself.

In my app I divide the window into areas with grabbars, so I can move the grabbars around to re-apportion the space. Then one has to make some decisions about what is supposed to happen if the window is resized, in terms of re-apportioning the reduced space.

1 Like

That’s only automatic on web.

1 Like

Okay, so that makes sense. I thought I had recalled auto scrolling.

The tutorials available are either really old or they’re missing info.

I think I’m going to put in a feature request for scrolling on Container controls. I’m surprised that scrolling on container controls is not an option on all platforms.

And we do indeed have a request for scrollbars on a container control that is smaller than the space allocated for it in a window, see: https://tracker.xojo.com/xojoinc/xojo/-/issues/39168

Nine years ago, there were other people in support of this.

We are using Graffiti scrollable area to add a scrollbar to the containers

3 Likes

Welp, I am too poor to afford that right now. I saw references to placing controls on a canvas … from back in 2018.

-_____-

Gonna crack this nut one way or another…

https://documentation.xojo.com/api/user_interface/desktop/desktopcanvas.html

and see the Scroll() method.

1 Like

Hi @Amy_Barnes,

you could also take a look at https://forum.xojo.com/t/ann-stackview-3-2-is-now-available.

Good luck.

In addition to the excellent GraffitiSuite scrollable area, there is also the PiDog Scrolling Canvas.

1 Like

I actually found a workaround based on an old post somewhere… I’ll be posting it and pics shortly so that others can use this.

2 Likes

Here is how to scroll a 1600-pixel container in a 523-pixel space:

  1. Create your initial container with all your controls.
  2. Create your shell container, larger than your original one by the scrollbar space.
  3. Add Scrollbars
  4. ON your Scrollbar, create event handlers: (1) Opening, and (2) ValueChanged.

Opening:

Me.MaximumValue = ControlsContainer.Height - Me.Height

ValueChanged:

ControlsContainer.Top = (Me.Value * -1)
ControlsContainer.Refresh

AND THEN … you drag your container containing the controls container…
into your final destination.

And finally you can click Ctrl + R to run … that one line commanding a Refresh is critical because your graphics will not update effectively otherwise… especially for a very large project.

Hope this helps!

4 Likes

I was just working on an example project for this exact method that I learned so many moons ago. I thought there was an example project for this, but I can’t locate it.

My example also shows how to handle a scroll wheel on the view and how to dynamically recalculate the scrollbar max value when necessary.

Example project: Scroller.xojo_binary_project

10 Likes

I’m surprised that scrollbars and container controls were never in the Xojo sample projects by this point in time.

Okay that text in there was hilarious.
Thanks for the laugh that I needed today!

2 Likes

I agree, scrolling isn’t so hard :grin: