I have a CSpinButtonCtrl
class subclassed called MySpinButtonCtrl
. In this class I have an OnDeltapos
event declared which is in charge of increment and decrement numeric values on my spinner:
void CMySpinButtonCtrl::OnDeltapos(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
if (GetKeyState(VK_CONTROL) < 0) // ctrl key pressed ==> limit value
{
int lower, upper;
GetRange(lower, upper);
if (pNMUpDown->iDelta < 0)
*pResult = MySetSpinPos(lower); // lower limit
else
*pResult = MySetSpinPos(upper); // upper limit
}
else
{
int nDelta;
if (GetKeyState(VK_SHIFT) < 0) // shift key pressed==> speed x 10
nDelta = 10 * pNMUpDown->iDelta;
else
nDelta = pNMUpDown->iDelta;
*pResult = MySetSpinPos(pNMUpDown->iPos + nDelta);
}
}
When I keep pressed my spinner with the left mouse button it works perfectly fine, however when I try pressing my spinner with a touch screen, it needs two pressed gestures.
I have tried catching the press touch event with OnPointerDown
, but I have no idea how to implement it:
afx_msg LRESULT CMySpinButtonCtrl::OnPointerdown(WPARAM wParam, LPARAM lParam)
{
if (IS_POINTER_PRIMARY_WPARAM(wParam))
{
//TODO
}
return 0;
}
Is there any way to call OndeltaPos
from OnPointerDown
?
I will appreciate any kind of help.