Solved

CSpinButtonCtrl

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

Gigs: Get Your Project Delivered by an Expert

Select from 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

Suggested Solutions

Title # Comments Views Activity
Hibernate methods 2 71
firstChar challenge 13 115
how to use laptop or pad camera in vb.net windows application 2 71
Way to decrease size of apk file 9 66
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

776 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