win32
asked on
GetUpDown, from CSpinButtonCtrl
Hi, I can get the pos.. by caling CSpinButtonCtrl.GetPos(), But I don't need it.. All I need to know is, if I hit the UP, or DOWN button...
How is that done ?
What I've done now is, somthing lik this
If(OldPop<NewPos)POS_IS_IN CREASED = true;
But the programming looks bad, can't I get a flag, that tels me if its up, or down ???
CB.
How is that done ?
What I've done now is, somthing lik this
If(OldPop<NewPos)POS_IS_IN
But the programming looks bad, can't I get a flag, that tels me if its up, or down ???
CB.
CSpinButtonControl sent notify message UDN_DELTAPOS.
Get that message from Your control and You will have as lParam struct NMUPDOWN.
struct
{
NMHDR hdr;
int iPos;// current position
int iDelta;// proposed change in position
} NMUPDOWN;
Get that message from Your control and You will have as lParam struct NMUPDOWN.
struct
{
NMHDR hdr;
int iPos;// current position
int iDelta;// proposed change in position
} NMUPDOWN;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
How do I find, UDN_DELTAPOS... ?
if (HIWORD (wParam) == UDN_DELTAPOS) MessageBox("Test");
Like this or how, is it to be found ?
if (HIWORD (wParam) == UDN_DELTAPOS) MessageBox("Test");
Like this or how, is it to be found ?
ASKER
Sorry. I found it !!
As I said it gets sent in the form of WM_NOTIFY message. So it sould be something like that:
CYourDlg::OnWmNotify(...)
{ if(HOWORD(wParam) == UDN_DELTAPOS)
MessageBox("text");
}
CYourDlg::OnWmNotify(...)
{ if(HOWORD(wParam) == UDN_DELTAPOS)
MessageBox("text");
}
win32:
add this declaration to the .h file:
add this code to the MESSAGE MAP in the .cpp:
BEGIN_MESSAGE_MAP(...)
.
.
ON_NOTIFY(UDN_DELTAPOS, IDC_USER_ID_SPIN, OnDeltaposUserIdSpin)
.
.
END_MESSAGE_MAP()
IDC_USER_ID_SPIN-> is the spin control resource ID
the callbacl function of the spin control:
void CMyDlg::OnDeltaposUserIdSp in(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
if(pNMUpDown->iDelta > 0)
{
//up
}
else
{
//down
}
UpdateData();
*pResult = 0;
}
thats it...
add this declaration to the .h file:
add this code to the MESSAGE MAP in the .cpp:
BEGIN_MESSAGE_MAP(...)
.
.
ON_NOTIFY(UDN_DELTAPOS, IDC_USER_ID_SPIN, OnDeltaposUserIdSpin)
.
.
END_MESSAGE_MAP()
IDC_USER_ID_SPIN-> is the spin control resource ID
the callbacl function of the spin control:
void CMyDlg::OnDeltaposUserIdSp
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
if(pNMUpDown->iDelta > 0)
{
//up
}
else
{
//down
}
UpdateData();
*pResult = 0;
}
thats it...
add this declaration to the .h file:
afx_msg void OnDeltaposUserIdSpin(NMHDR * pNMHDR, LRESULT* pResult);
now its ok....
cheers mate
afx_msg void OnDeltaposUserIdSpin(NMHDR
now its ok....
cheers mate
lParam of the message is a pointer to the NMUPDOWN structure where you have to check iDelta value. This is a change you need.