Don't invalidate best size for controls with wxST_NO_AUTORESIZE
This results in non-intuitive behaviour, as the controls with this style still get resized after changing their label, so don't do it. See https://groups.google.com/d/msg/wx-dev/58xFP4FIxXc/hm5WO0xNBwAJ
This commit is contained in:
@@ -205,16 +205,21 @@ void wxStaticTextBase::Wrap(int width)
|
||||
|
||||
void wxStaticTextBase::AutoResizeIfNecessary()
|
||||
{
|
||||
// This method is only called if either the label or the font changed, i.e.
|
||||
// if the label extent changed, so the best size is not the same neither
|
||||
// any more.
|
||||
InvalidateBestSize();
|
||||
|
||||
// This flag is specifically used to prevent the control from resizing even
|
||||
// when its label changes.
|
||||
if ( HasFlag(wxST_NO_AUTORESIZE) )
|
||||
return;
|
||||
|
||||
// This method is only called if either the label or the font changed, i.e.
|
||||
// if the label extent changed, so the best size is not the same neither
|
||||
// any more.
|
||||
//
|
||||
// Note that we don't invalidate it when wxST_NO_AUTORESIZE is on because
|
||||
// this would result in the control being effectively resized during the
|
||||
// next Layout() and this style is used expressly to prevent this from
|
||||
// happening.
|
||||
InvalidateBestSize();
|
||||
|
||||
SetSize(GetBestSize());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user