summaryrefslogtreecommitdiff
path: root/src/mir_core
diff options
context:
space:
mode:
Diffstat (limited to 'src/mir_core')
-rw-r--r--src/mir_core/src/CCtrlBase.cpp8
-rw-r--r--src/mir_core/src/CCtrlEdit.cpp2
2 files changed, 3 insertions, 7 deletions
diff --git a/src/mir_core/src/CCtrlBase.cpp b/src/mir_core/src/CCtrlBase.cpp
index b940d00bef..c07055c658 100644
--- a/src/mir_core/src/CCtrlBase.cpp
+++ b/src/mir_core/src/CCtrlBase.cpp
@@ -47,12 +47,7 @@ CCtrlBase::~CCtrlBase()
void CCtrlBase::OnInit()
{
- if (m_idCtrl && m_parentWnd && m_parentWnd->GetHwnd()) {
- m_hwnd = GetDlgItem(m_parentWnd->GetHwnd(), m_idCtrl);
-
- m_bSilent = (GetWindowLong(m_hwnd, GWL_STYLE) & WS_DISABLED) == 0;
- }
- else m_hwnd = nullptr;
+ m_hwnd = (m_idCtrl && m_parentWnd && m_parentWnd->GetHwnd()) ? GetDlgItem(m_parentWnd->GetHwnd(), m_idCtrl) : nullptr;
}
void CCtrlBase::OnDestroy()
@@ -85,7 +80,6 @@ void CCtrlBase::Show(bool bShow)
void CCtrlBase::Enable(bool bIsEnable)
{
::EnableWindow(m_hwnd, bIsEnable);
- m_bSilent = !bIsEnable;
}
bool CCtrlBase::Enabled() const
diff --git a/src/mir_core/src/CCtrlEdit.cpp b/src/mir_core/src/CCtrlEdit.cpp
index 7a95f34300..3f60855843 100644
--- a/src/mir_core/src/CCtrlEdit.cpp
+++ b/src/mir_core/src/CCtrlEdit.cpp
@@ -54,6 +54,8 @@ bool CCtrlEdit::OnApply()
void CCtrlEdit::OnReset()
{
+ m_bSilent = (GetWindowLong(m_hwnd, GWL_STYLE) & ES_READONLY) != 0;
+
if (GetDataType() == DBVT_WCHAR)
SetText(LoadText());
else if (GetDataType() != DBVT_DELETED)