I’m trying to use a ComponentBoundsConstrainer to stop components being dragged off the side of another component.
In my component that’s being dragged, I create a ComponentBoundsConstrainer and set the min on screen amounts:
bounds_ = new ComponentBoundsConstrainer(); bounds_->setMinimumOnscreenAmounts(0xffffff,0xffffff,0xffffff,0xfffffff);
The dragged component is a child of the component to constraint it’s position within.
To try and stop it being moved off the edge of the parent, in the dragged components moved() I call:
This works fine on the Mac, but on Windows it enters an endless loop calling moved() repeatedly when the component is dragged off the edge. I do something similar in resized() when resizing the component and this works fine on both Mac and Windows when resizing the component off the edge.
I’ve tried this with the latest from Git.
This seems like a bug because of the difference between Mac and Windows, but on the other, hand perhaps this isn’t the best way of doing this because there is a difference between the way Mac and Windows events are handled? If so, can anyone suggest a better way to do this avoiding this loop?