Seems simple enough:
“To use a Viewport, just create one and set the component that goes inside it using the setViewedComponent() method. When the child component changes size, the Viewport will adjust its scrollbars accordingly.”
So, I started with an existing component (slComp) that appears as a window when the user clicks a button. The user can add items to that component and increase the vertical size. That worked and now I need a vertical scrollbar, but I must not be using Viewport correctly.
slComp = new SpeakerLayoutComponent(); // a custom component with rows of text boxes for specifying a speaker layout
slView = new Viewport();
slView->setSize(800, 600);
slView->setViewedComponent(slComp);
then when a button is clicked:
slView->setTopLeftPosition(300, 100);
slView->addToDesktop(ComponentPeer::windowHasTitleBar);
// i used these lines before i needed a Viewport and it worked fine
//slComp->setTopLeftPosition(300, 100);
//slComp->addToDesktop(ComponentPeer::windowHasTitleBar);
Nothing shows now. There must be another way to show the viewport. What am I missing or doing wrong?
Thanks!