summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-03-15 15:01:36 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-03-15 15:01:36 +0300
commitd49094d01430c0a0f4b8aa39a3e4cf619be7d9f2 (patch)
tree8bcef66e2ac8c2a8f80e5af7dc4cbdb06987a252 /src
parent8e2660cbe6b4d3de6d63d2a3644ce11e99b4b9c6 (diff)
fixes #2766 (Spin control suddenly returns previous position when called from inside WM_NOTIFY)
Diffstat (limited to 'src')
-rw-r--r--src/mir_core/src/CCtrlSpin.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mir_core/src/CCtrlSpin.cpp b/src/mir_core/src/CCtrlSpin.cpp
index 361c3eb74f..2c254025b7 100644
--- a/src/mir_core/src/CCtrlSpin.cpp
+++ b/src/mir_core/src/CCtrlSpin.cpp
@@ -34,6 +34,9 @@ CCtrlSpin::CCtrlSpin(CDlgBase *dlg, int ctrlId, WORD wMax, WORD wMin) :
BOOL CCtrlSpin::OnNotify(int, NMHDR *pnmh)
{
if (pnmh->code == UDN_DELTAPOS) {
+ auto *pEvent = (NMUPDOWN *)pnmh;
+ m_wCurr = pEvent->iPos + pEvent->iDelta;
+
NotifyChange();
return TRUE;
}
@@ -59,10 +62,10 @@ void CCtrlSpin::OnReset()
WORD CCtrlSpin::GetPosition()
{
- return SendMsg(UDM_GETPOS, 0, 0);
+ return m_wCurr;
}
void CCtrlSpin::SetPosition(WORD wPos)
{
- SendMsg(UDM_SETPOS, 0, wPos);
+ SendMsg(UDM_SETPOS, 0, m_wCurr = wPos);
}