Hello,
I am looking for recommendations on how to constrain an expanded wxPanel in a wxScrolledWindow. My setup is that I have a parent class derived from a wxScrolledWindow, and it has a wxPanel child that was added with the wxEXPAND flag. When the parent window expands, the child expands with it as expected. However, when I start to shrink the parent window, the child does not resize (it keeps its original size) and the horizontal and vertical scrollbars appear. I understand this is the default behavior.
However, the behavior I would would like is for the child to shrink back to the original width, but for the user to be able to scroll vertically. Are there any recommendations on how to do this?
In the OnSize event handler of my child class, I have printed out the current size and noticed that it remains the full size (after I expand the parent window fully, and the child expands with it).
Constraining expanded wxPanel in wxScrolledWindow
Re: Constraining expanded wxPanel in wxScrolledWindow
This is an unusual scenario and i can't think of any easy/elegant solution. I think you need to catch the size event handler of the scrolled window and calculate and set a fitting minimum width for the panel to make it shrink back.
Use the source, Luke!