I have a static text control that changes it contents based on user actions. It is in a horizontal sizer with several other control. When the text changes, the control dynamically updates its size, but it doesn't dynamically adjust it's position in the sizer, ie, it overlaps a sibling control until I resize the main window manually, after which it all looks good again.
How do I cause the sizer to automatically re-adjust so everythings fits?
The simplest way is to call
Layout()
on the top level window parent returned bywxGetTopLevelParent()
. This is not the most efficient way as it can result in re-laying out too much and you can always restrict the layout to just the deepest sizer or window containing the window that changed size whose size needs to update, but, again, doing it at TLW level is the simplest way.