Viewports for Newbie


#1

I have a component (the “widget”) that I drag around on a parent component (the “Stage”). On mouseDrag, I call autoScroll to make the widget stay in the visible area if it is dragged out of view.
However, what’s happening with me is that this moves the scroll bars but does not nudge the stage back so that the widget is visible.

Is this something I’m supposed to code myself, perhaps in visibleAreaChanged() ? If so, what sorts of things are supposed to happen in that call? I’ve looked at the ListBox code, but something’s not clear, I’m not getting it. For instance I’m getting tripped up by the contentComp and contentHolder objects. Right now I have my Stage as the viewport’s contentComp, but ListBox doesn’t do it that way.

Can someone clear this up for me?