Fix text drawing in caret sample with wxGTK3 and wxOSX
Don't use wxClientDC for drawing the text, just refresh the updated character. See #17820.
This commit is contained in:
parent
3533decf93
commit
7463d514bf
@ -473,12 +473,12 @@ void MyCanvas::OnChar( wxKeyEvent &event )
|
||||
wxChar ch = (wxChar)event.GetKeyCode();
|
||||
CharAt(m_xCaret, m_yCaret) = ch;
|
||||
|
||||
wxCaretSuspend cs(this);
|
||||
wxClientDC dc(this);
|
||||
dc.SetFont(m_font);
|
||||
dc.SetBackgroundMode(wxBRUSHSTYLE_SOLID); // overwrite old value
|
||||
dc.DrawText(ch, m_xMargin + m_xCaret * m_widthChar,
|
||||
m_yMargin + m_yCaret * m_heightChar );
|
||||
wxRect rect(
|
||||
m_xMargin + m_xCaret * m_widthChar,
|
||||
m_yMargin + m_yCaret * m_heightChar,
|
||||
m_widthChar,
|
||||
m_heightChar);
|
||||
RefreshRect(rect, false /* don't erase background */);
|
||||
|
||||
NextChar();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user