Solved

CSpinButtonCtrl

Posted on 2001-06-12
4
489 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
[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
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

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: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.

734 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