I had a window that was getting taller due to adding more and more things into it, so I decided to make it scrollable. The first thing I did, therefore, was to add a canvas to the window, resize it to the window (minus a bit for the scrollbar), and sent it to the back using the layering controls. I then added the event handlers etc to handle the actual scrolling aspects. Various posts here were helpful in that regard.
When I came to test it, however, I found that most of the controls did not move. This was because they were not on the canvas, and no matter what I did with the layering buttons, I couldn’t get these controls to reliably be on the canvas. A couple of controls were properly embedded (why them? Who knows), and they moved as expected with the mousewheel, so that showed that the scrolling aspects were correct.
What I had to do in the end was select all the non-scrolling controls, move them out of the window, de-select them, select them all again, and move them back to where they were. Then all worked as expected.
Is this a limitation of the IDE or is there a better way to get existing controls onto a canvas that is added after the controls are in place?
You have to make sure the controls are children of the canvas for them to scroll correctly. When you drag the control over, you will notice a read outline around the canvas.
But you can also make a control child of the canvas in code in Open, for instance if it is not over the canvas in the IDE
[quote=360535:@Tim Streater]What I had to do in the end was select all the non-scrolling controls, move them out of the window, de-select them, select them all again, and move them back to where they were. Then all worked as expected.
Is this a limitation of the IDE or is there a better way to get existing controls onto a canvas that is added after the controls are in place?[/quote]
You should have been able to nudge them with the mouse or keyboard to get the parenting to take effect. Personally I usually use the keyboard because its easier to control. One pixel up, one pixel down.