Swtsvn
Swtsvn

Reputation: 335

wxStaticText refreshes and sometimes disappears

I am using wxStaticText in my application with the basic setup

wxStaticText* m_staticText8 = new wxStaticText( m_panel3, wxID_ANY, wxT("Description"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText8->Wrap( -1 );
fgSizer6->Add( m_staticText8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 2 );

It is a multi threaded application, and the main work happens in a child thread. The text's label does not change throughout the application.

The issues is that the "Description" label flickers, sometimes disappears for some time when the child thread is under heavy work load. I am not sure how to fix it so that the label does not refresh/flicker/disappear. Any body knows how to?

Upvotes: 0

Views: 323

Answers (1)

Swtsvn
Swtsvn

Reputation: 335

I only had that much information that I posted the question with, hence I was not hiding any information that might lead to more accurate responses. I did not add more code, because it was all the code I had related to static text. More over it was a huge project, and I could not have possibly posted all of it here. Nothing more nothing else. I posted the question, so that in case someone else had already experienced and fixed it, they might be able to recognize it and answer.

That being said, I have managed to reduce the flickering using the methods (enable double buffer and disable erase background) mentioned in this old post https://wiki.wxwidgets.org/Flicker-Free_Drawing.

This reduced the refreshes for the text that created flickering effect. But the problem did not go away completely. Then via brute force, I managed to find out an order of layouts in the wxForm that helped keep the text stable to a great extent. I am not sure why it works, but it just does. I had to add wxStaticBoxSizer that had wxPanel, which had wxFlexGridSizer which had the wxStaticText. Don't ask me how can it possibly fix the flickering issue, because I don't have the answer. But somehow having the text inside the panel in this manner holds it together. If anyone out there knows why, kindly let me and others know.

Thanks.

Upvotes: 1

Related Questions