Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CSpinButtonCtrl

Posted on 2001-06-12
4
Medium Priority
?
503 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 200 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

715 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