Solved

CSpinButtonCtrl

Posted on 2001-06-12
4
486 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 31

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

830 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