[wx-dev] wxStaticText resize on minimization

Jacob Barsøe Kjærgaard Jacob.Kjaergaard at prevas.dk
Wed Dec 19 01:24:49 PST 2007


Hi,

I have attached a small patch to the minimal sample, such that the behavior =

described below can be reproduced.
1) Start it up.
2) Check labels positions
3) Click change label - label is not resized
4) minimize to taskbar and back -> label is resized

/Jacob

On Tue, 18 Dec 2007 16:01:55 +0100 Jacob Bars=C3=B8e Kj=C3=A6rgaard <Jacob.=
Kjaergaard at prevas.dk>
wrote:

JBK> During development of an msw-application I has come across some odd =

JBK> behavior of wxStaticText class. If the object is constructed with the =

JBK> style flag wxST_NO_AUTORESIZE the object correctly doesn't resize afte=
r =

JBK> a call to SetLabel(). However, a wxStaticText object is resized though=
, =

JBK> if the application is minimized and then restored back to regular size=
. =

JBK> =

JBK> I'm wondering if this behavior is regular or a bug.

 It's a bug. If you could submit a (simplest possible) patch to the minimal
sample allowing to reproduce it, I can try to have a look at fixing it. Of
course, if you can do it yourself, this would be even greater.

 Thanks,
VZ

-------------- next part --------------
71,72d70
<     void ChangeLabel(wxCommandEvent& event);
< =

74,75d71
<     wxStaticText * m_stTEST; //test for resize on minimization
< =

106d101
<     EVT_BUTTON(45, MyFrame::ChangeLabel)  //test for resize on minimizati=
on
175,188d169
<     //test for resize on minimization
<     m_stTEST =3D new wxStaticText(this, wxID_ANY, _T("1234"), wxDefaultPo=
sition, wxDefaultSize, wxST_NO_AUTORESIZE | wxALIGN_RIGHT);
<     wxStaticText *tmp =3D new wxStaticText(this, wxID_ANY, _T("56789"), w=
xDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE | wxALIGN_LEFT);
<     wxBoxSizer *bsTEST =3D new wxBoxSizer(wxHORIZONTAL);
<     wxButton *button =3D new wxButton(this, 45, _T("change label"));
<     bsTEST->Add(m_stTEST, 0, 0, 0, 0);
<     bsTEST->Add(tmp, 0, 0, 0, 0);
<     bsTEST->Add(button, 0, 0, 0, 0);
< =

<     SetSizer(bsTEST);
<     bsTEST->SetSizeHints(this);
<     tmp->SetBackgroundColour( *wxRED );
< =

< =

219,227d199
< =

< //test for resize on minimization
< void MyFrame::ChangeLabel(wxCommandEvent& WXUNUSED(event))
< {
<     if (m_stTEST->GetLabel() =3D=3D _T("1234"))
<         m_stTEST->SetLabel(_T("a"));
<     else
<         m_stTEST->SetLabel(_T("1234"));
< }
\ No newline at end of file


More information about the wx-dev mailing list