diff --git a/SDK/include/NDK/Widgets/TextAreaWidget.inl b/SDK/include/NDK/Widgets/TextAreaWidget.inl index 29b7cff98..35e7c67ee 100644 --- a/SDK/include/NDK/Widgets/TextAreaWidget.inl +++ b/SDK/include/NDK/Widgets/TextAreaWidget.inl @@ -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) diff --git a/SDK/src/NDK/Widgets/TextAreaWidget.cpp b/SDK/src/NDK/Widgets/TextAreaWidget.cpp index 19071cac2..52a879b14 100644 --- a/SDK/src/NDK/Widgets/TextAreaWidget.cpp +++ b/SDK/src/NDK/Widgets/TextAreaWidget.cpp @@ -141,7 +141,8 @@ namespace Ndk void TextAreaWidget::OnFocusReceived() { - m_cursorEntity->Enable(true); + if (!m_readOnly) + m_cursorEntity->Enable(true); } void TextAreaWidget::OnKeyPressed(const Nz::WindowEvent::KeyEvent& key) @@ -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);