[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 504
  • Last Modified:

Catch Button DOWN events

I would like to build a momentary button that activates when pressed
and stops when released.  Sound simple?  However, I can't seem to find
any way to catch the mouse down event within the button.  I've tried
subclassing the button and using the OnChildNotify and this got me
some events but not the button down ones.  Does anybody have an example
on doing this?  I've been all through the MSDN CD-ROM without luck.

Thanks,

Ken West
0
Ken_West
Asked:
Ken_West
1 Solution
 
syed_dgreatCommented:
Try using this:-

Derive a new class from CButton and provide two handlers:-
OnLButtonDown and OnLButtonUp.

First, whenever you press down the button (OnLButtonDown),
do whatever you want (you said
activates when pressed on it right?).
Then later you would stop whenever OnLButtonUp event is detected, you will stop whatever is activated.
Remember also, subclass this dlgitem in your OnInitDialog.

0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now