I just did more test:
1, I try to minimize the issue, so I add such code in our cctest w30 project.
Here is the modified function:
void CCTestFrame::OnUpdate(wxScintillaEvent &WXUNUSED(event))
{
int min = m_Control->GetCurrentPos ();
int max = m_Control->BraceMatch (min);
if (max > (min+1)) {
m_Control->BraceHighlight (min, max);
int pos = m_Control->GetCurrentLine();
wxString msg;
msg.Printf(_("Line %d, Column %d"), m_Control->GetCurrentLine() + 1, m_Control->GetColumn(pos) + 1);
SetStatusText(msg, 0);
}else{
m_Control->BraceBadLight (min);
}
}
You see here, I have both set the BraceHighlight and the Status Bar.
Now, the issue happens.
2, I did a quite similar test on the wx 3.0.2's build in stc sample:
Add a status bar in the frame's constructor(a member variable wxStatusBar* m_StatuBar; is need also)
m_StatuBar = new wxStatusBar(this, wxID_ANY, 0, _T("wxID_ANY"));
int __wxStatusBarWidths_1[1] = { -10 };
int __wxStatusBarStyles_1[1] = { wxSB_NORMAL };
m_StatuBar->SetFieldsCount(1,__wxStatusBarWidths_1);
m_StatuBar->SetStatusStyles(1,__wxStatusBarStyles_1);
SetStatusBar(m_StatuBar);
Then, bind the event to the frame, not the Edit control.
void AppFrame::OnUpdate(wxStyledTextEvent &WXUNUSED(event))
{
int min = m_edit->GetCurrentPos ();
int max = m_edit->BraceMatch (min);
if (max > (min+1)) {
m_edit->BraceHighlight (min, max);
int pos = m_edit->GetCurrentLine();
wxString msg;
msg.Printf(_("Line %d, Column %d"), m_edit->GetCurrentLine() + 1, m_edit->GetColumn(pos) + 1);
SetStatusText(msg, 0);
}else{
m_edit->BraceBadLight (min);
}
}
The macro is like below:
// handle the update event
EVT_STC_UPDATEUI(wxID_ANY, AppFrame::OnUpdate)
Note, that you need to comment out the EVT_STC_UPDATEUI macro inside the edit.cpp.
The result is: It works OK without the issue.
EDIT: I see that this issue also happens!!
I really don't know why SetStatusText() call cause such issue. Is it caused by the local variable msg?
EDIT: Now, I see all the above cases will cause the issue!