Solved

GetUpDown, from CSpinButtonCtrl

Posted on 2001-06-12
8
791 Views
Last Modified: 2013-11-20
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_INCREASED = true;

But the programming looks bad, can't I get a flag, that tels me if its up, or down ???

CB.
0
Comment
Question by:win32
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 6

Expert Comment

by:MichaelS
Comment Utility
You have to take a look at UDN_DELTAPOS message. It's sould arrive to the parent of you Spin control in the form of WM_NOTIFY message.

lParam of the message is a pointer to the NMUPDOWN structure where you have to check iDelta value. This is a change you need.
0
 
LVL 2

Expert Comment

by:MadYugoslav
Comment Utility
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;
0
 
LVL 42

Accepted Solution

by:
sedgwick earned 50 total points
Comment Utility
add UDN_DELTAPOS message handler using the wizard:

void CZ3LicenseGenDlg::OnDeltaposUserSpin(NMHDR* pNMHDR, LRESULT* pResult)
{
     NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
     if(pNMUpDown->iDelta > 0)
     {
//spin up
     }
     else
     {
//spin down
     }
     UpdateData();
     
     *pResult = 0;
}

good luck
0
 

Author Comment

by:win32
Comment Utility
How do I find, UDN_DELTAPOS... ?
if (HIWORD (wParam) == UDN_DELTAPOS) MessageBox("Test");

Like this or how, is it to be found ?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:win32
Comment Utility
Sorry. I found it !!
0
 
LVL 6

Expert Comment

by:MichaelS
Comment Utility
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");
}
0
 
LVL 42

Expert Comment

by:sedgwick
Comment Utility
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::OnDeltaposUserIdSpin(NMHDR* pNMHDR, LRESULT* pResult)
{
     NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;

     if(pNMUpDown->iDelta > 0)
{
//up
}
     else
{
//down
}    

     UpdateData();
     
     *pResult = 0;
}

thats it...
0
 
LVL 42

Expert Comment

by:sedgwick
Comment Utility
add this declaration to the .h file:

     afx_msg void OnDeltaposUserIdSpin(NMHDR* pNMHDR, LRESULT* pResult);

now its ok....

cheers mate
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now