[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

GetUpDown, from CSpinButtonCtrl

Posted on 2001-06-12
8
Medium Priority
?
918 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:
Meir Rivkin earned 200 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
Independent Software Vendors: 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:Meir Rivkin
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:Meir Rivkin
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

650 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