xojo

TabPanel and scrolling


I'm pretty new with Xojo and I've stumbled on a roadblock on the desktop project I'm working on.

I have a TabPanel that gets populated with custom ContainerControls at runtime (data is fetched from a httpsocket, and that part pretty much works). Problem is, the number of controls is variable so they can (and do) end being drawn outside the window's edges.

I could simply spread the containers on multiple tabs but scrolling on a single one is what's being requested, so either I find a way to add it (and at the moment I'm totally lost on how) or I'll have to drop the TabControl and try something else (and that comes with the problem that having tabs is another request).

Could really use a nudge in the right direction.


Solution

  • Look into scrolling canvas or a container control. In the case of the canvas the positioning of the scroll is handled for you. In the case of a container control you'll have deal with positioning of the control yourself.

    The documentation for canvas.Scroll: http://docs.xojo.com/Canvas.Scroll

    In generally, you will need to calculate if the required area is bigger than your visible area and resize your canvas or container to fit them accordingly. Add scrollbars to be able to scroll in the vertical and horizontal direction.