diff options
-rw-r--r-- | include/m_gui.h | 2 | ||||
-rw-r--r-- | src/mir_core/src/CCtrlSpin.cpp | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/include/m_gui.h b/include/m_gui.h index a3e211b7b4..73fd9de525 100644 --- a/include/m_gui.h +++ b/include/m_gui.h @@ -867,7 +867,7 @@ class MIR_CORE_EXPORT CCtrlSpin : public CCtrlData {
typedef CCtrlData CSuper;
- WORD m_wMin, m_wMax;
+ WORD m_wMin, m_wMax, m_wCurr;
BOOL OnNotify(int, NMHDR*) override;
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); } |