'quantizing' resize


I have DocumentWindow which contains a Viewport, which contains a bunch of vertical strip Componenets (mixer channels). I would like to constrain/quantize the resizing of the DocumentWindow so that the Viewport always contains whole strips. Can someone point me in the right direction? Thanks.


You’ll want to implement your own ComponentBoundsConstrainer, and provide it to your window. [see the docs for that class and also ResizableWindow for how to set it on your window]


Thanks haydxn… I had already taken a peak at that class, but it’s just not clear to me what I need to do after subclassing it for my own usage… ie. it’s not clear if I will be getting some sort of callbacks during the resize, or a final callback when the resize is complete. Or, do I have to create a subclass similar to ResizableBorderComponent, where I override the mouseUp/Down/Drag stuff like it does. And, of course, I can’t find any examples of something like this… :frowning: I don’t want to be one of those guys asking for things to be completely spelled out, so feel free to tell me to dig deeper! lol…


anyone? bueler? :slight_smile:


I could be wrong, but I don’t think you need to be subclassing ComponentBoundsConstrainer, but creating one, and then passing it into your window via ResizableWindow::setConstrainer(ComponentBoundsConstrainer *newConstrainer). As long as your constrainer has the appropriate bounds set, that should stop the window from resizing beyond that. If you needed other kinds of custom control however, it looks like you could subclass ComponentBoundsContrainer, and do them by implementing/overridding a few of its virtual methods.