Solved

GetUpDown, from CSpinButtonCtrl

Posted on 2001-06-12
8
862 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
ID: 6180957
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
ID: 6180966
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
ID: 6181106
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

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

Like this or how, is it to be found ?
0
 

Author Comment

by:win32
ID: 6181685
Sorry. I found it !!
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6181711
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
ID: 6181715
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
ID: 6181730
add this declaration to the .h file:

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

now its ok....

cheers mate
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

679 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