Sdk/TextAreaWidget: Fix cursor showing up on readonly text area

This commit is contained in:
Jérôme Leclercq 2017-11-23 13:24:13 +01:00
parent d98b7a8f4f
commit 3cff3fbadc
2 changed files with 6 additions and 3 deletions

View File

@ -170,8 +170,7 @@ namespace Ndk
inline void TextAreaWidget::SetReadOnly(bool readOnly)
{
m_readOnly = readOnly;
m_cursorEntity->Enable(!m_readOnly);
m_cursorEntity->Enable(!m_readOnly && HasFocus());
}
inline void TextAreaWidget::SetText(const Nz::String& text)

View File

@ -141,6 +141,7 @@ namespace Ndk
void TextAreaWidget::OnFocusReceived()
{
if (!m_readOnly)
m_cursorEntity->Enable(true);
}
@ -289,6 +290,9 @@ namespace Ndk
void TextAreaWidget::RefreshCursor()
{
if (m_readOnly)
return;
const auto& lineInfo = m_drawer.GetLine(m_cursorPosition.y);
std::size_t cursorGlyph = GetGlyphIndex(m_cursorPosition);