Fix wxStaticText label wrapping in wxGTK Both using wxST_WRAP and explicitly calling Wrap() from wxEVT_SIZE handler could result in making the visible label completely empty due to SetLabel(m_unwrappedLabel) call in wxStaticTextBase::Wrap() not working as expected: at least in wxGTK, m_unwrappedLabel was reset by SetLabel() before being actually used. Fix this by passing the already existing local copy of m_unwrappedLabel to this function instead. See https://stackoverflow.com/questions/79948024/wxwidgets-text-wrapping-causes-the-text-to-disappear
| ... | ... | @@ -272,7 +272,11 @@ void wxStaticTextBase::Wrap(int width) |
| 272 | 272 | : m_unwrappedLabel;
|
| 273 | 273 | if ( !m_unwrappedLabel.empty() )
|
| 274 | 274 | {
|
| 275 | - SetLabel( m_unwrappedLabel );
|
|
| 275 | + // This is tricky: we can't pass m_unwrappedLabel itself to SetLabel()
|
|
| 276 | + // because it can/will be reset to empty string by this call before it
|
|
| 277 | + // is used. So pass a copy of it which is not affected by the changes
|
|
| 278 | + // to m_unwrappedLabel.
|
|
| 279 | + SetLabel( unwrappedLabel );
|
|
| 276 | 280 | }
|
| 277 | 281 | wxLabelWrapper wrapper;
|
| 278 | 282 | wrapper.WrapLabel(this, width);
|
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help