Solved

CSpinButtonCtrl

Posted on 2001-06-12
4
475 Views
Last Modified: 2013-11-20
I want to make a handler for
a CSpinButtonCtrl, how is that done..
ON_BN_CLICKED(IDC_SPIN_BN, SomeThing)

Is not working, how can I make that handler ?
0
Comment
Question by:win32
4 Comments
 
LVL 30

Accepted Solution

by:
Zoppo earned 50 total points
ID: 6180165
Hi win32,

a spinbutton sends its parent a WM_VSCROLL or WM_HSCROLL message ... you can handle it i.e.
for a dialog somehow like this:

void CMyDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
  // IDC_SPINCONTROL is the ID of the Up-Down Control
  if ((pScrollBar != NULL) && (pScrollBar->GetDlgCtrlID() == IDC_SPINCONTROL))
  {
    // Do whatever you want to do when Up-Down control buttons are
    // pressed
    return;
  }

  CDialog::OnVScroll( nSBCode, nPos, pScrollBar );
}

hope that helps,

ZOPPO
0
 
LVL 2

Expert Comment

by:GloriousRain
ID: 6180211
Hi win32,
if you really want to make a handler for
ON_BN_CLICKED(IDC_SPIN_BN, SomeThing):
- Create new class is inherited from CSpinButtonCtlr
- Add function for ON_WM_LBUTTONUP
ex:
void CMySpin::OnLButtonUp(UINT nFlags, CPoint point)
{
   CRect rect;
   GetWindowRect(rect);
   ScreenToClient(rect);
   if (rect.PtInRect(point))
   // process mouse click here
;
   CSpinButtonCtrl::OnLButtonUp(nFlags, point);
}

0
 

Author Comment

by:win32
ID: 6180551
What if I dont' what the position, but only OneUpKey,, OnDownKey

or something.. By the way I got it to work !
Thanks
0
 
LVL 6

Expert Comment

by:MichaelS
ID: 6180964
I did proposed a comment already in the similar question from you
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to create frequencies of a variable from SAS dataset? 10 116
sumDigits challenge 9 98
withoutTen challenge 14 88
Making an alias 7 54
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 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

9 Experts available now in Live!

Get 1:1 Help Now