From 9cece856f594b529aae2f42ad116d16cbb3c0e52 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 2 Dec 2016 16:25:50 +0300 Subject: if nothing else helps, finally read the manual - CCtrlSpin::SetRange had mixed up max & min values; - changing data in a spin control didn't send a change notification --- src/mir_core/src/mir_core.def | 3 ++- src/mir_core/src/mir_core64.def | 3 ++- src/mir_core/src/ui_utils.cpp | 16 +++++++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index ab1a87b9c7..6647e17126 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1036,5 +1036,6 @@ CallFunctionSync @1170 ?GetItemRect@CCtrlListBox@@QAEHHPAUtagRECT@@@Z @1193 NONAME ?SetItemHeight@CCtrlListBox@@QAEXHH@Z @1194 NONAME ?UseSystemColors@CCtrlBase@@QAEXXZ @1195 NONAME -?SetPosition@CCtrlSpin@@QAEXGG@Z @1196 NONAME +?SetPosition@CCtrlSpin@@QAEXG@Z @1196 NONAME ?GetPosition@CCtrlSpin@@QAEGXZ @1197 NONAME +?OnNotify@CCtrlSpin@@EAEHHPAUtagNMHDR@@@Z @1198 NONAME diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 2f448e51a0..80f401f367 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1036,5 +1036,6 @@ CallFunctionSync @1170 ?GetItemRect@CCtrlListBox@@QEAAHHPEAUtagRECT@@@Z @1193 NONAME ?SetItemHeight@CCtrlListBox@@QEAAXHH@Z @1194 NONAME ?UseSystemColors@CCtrlBase@@QEAAXXZ @1195 NONAME -?SetPosition@CCtrlSpin@@QEAAXGG@Z @1196 NONAME +?SetPosition@CCtrlSpin@@QEAAXG@Z @1196 NONAME ?GetPosition@CCtrlSpin@@QEAAGXZ @1197 NONAME +?OnNotify@CCtrlSpin@@EEAAHHPEAUtagNMHDR@@@Z @1198 NONAME diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp index a1ff5a9597..e4719b7372 100644 --- a/src/mir_core/src/ui_utils.cpp +++ b/src/mir_core/src/ui_utils.cpp @@ -676,19 +676,29 @@ CCtrlSpin::CCtrlSpin(CDlgBase *dlg, int ctrlId) : CCtrlBase(dlg, ctrlId) {} +BOOL CCtrlSpin::OnNotify(int, NMHDR *pnmh) +{ + if (pnmh->code == UDN_DELTAPOS) { + NotifyChange(); + return TRUE; + } + + return FALSE; +} + WORD CCtrlSpin::GetPosition() { return SendMsg(UDM_GETPOS, 0, 0); } -void CCtrlSpin::SetPosition(WORD wMax, WORD wMin) +void CCtrlSpin::SetPosition(WORD wPos) { - SendMsg(UDM_SETPOS, 0, MAKELONG(wMin, wMax)); + SendMsg(UDM_SETPOS, 0, wPos); } void CCtrlSpin::SetRange(WORD wMax, WORD wMin) { - SendMsg(UDM_SETRANGE, 0, MAKELONG(wMin, wMax)); + SendMsg(UDM_SETRANGE, 0, MAKELPARAM(wMax, wMin)); } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3