Solved

Catch Button DOWN events

Posted on 1997-05-08
1
499 Views
Last Modified: 2013-11-20
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
Comment
Question by:Ken_West
[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
1 Comment
 

Accepted Solution

by:
syed_dgreat earned 100 total points
ID: 1301418
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

696 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