Solved

Mouse Capture

Posted on 1997-10-12
10
432 Views
Last Modified: 2010-04-04
How do I pass a message that I have capture to the object that should receive the message?  Inherited does not seem to work.  Specifically, in a component is a trackbar. I capture the mouse.  When the user first tries to reposition the trackbar, the first attempt does not work, but release the capture of the mouse, so the next attempt works normally.  How can I get the first attempt to work normally?
0
Comment
Question by:charry
  • 5
  • 3
  • 2
10 Comments
 

Author Comment

by:charry
Comment Utility
Edited text of question
0
 
LVL 12

Expert Comment

by:andrewjb
Comment Utility
How exactly are you 'capturing' the mouse?
0
 

Author Comment

by:charry
Comment Utility
I am capturing the mouse by:
SetCapture(Self);

0
 
LVL 12

Expert Comment

by:andrewjb
Comment Utility
You're going to have to explain a bit more. I assume the form is doing the capturing? What for? I can't think of a neat way to pass the message on in that case, but there may be a different approach. More info, please!!
0
 

Author Comment

by:charry
Comment Utility
My goal was to create a componet that included a Trackbar.  I wanted the component to have an option that the Trackbar would not be visible until the mouse was over the component.  Similarly, I wanted the Trackbar to again not be visible when the mouse moved off the component.  Geting the component to be visible was no issue using WM_MouseMove.  However, finding out when the mouse left the component has been the issue.  That is why I tried to capture the mouse.
I have worked arount this problem by using a timer and test the location of the mouse when the component is visible.  I don't like this method since I am generating many cycles that are not necessary.  

0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Accepted Solution

by:
Gabor earned 100 total points
Comment Utility
Hi Charry,

Try the CM_MOUSEENTER and CM_MOUSELEAVE messages. I think it has to be work.

Good luck

Gabor
0
 

Author Comment

by:charry
Comment Utility
Gabor,
I can not find any references to CM_MouseEnter/CM_MouseLeave.  Do you know where I can find information, I search MicroSoft without success. If not could you provide the syntax for these calls.
Thanks
charry
0
 
LVL 1

Expert Comment

by:Gabor
Comment Utility
This is a custom BORLAND message. It is sent by the form to it's controls. You can't find any references, but it works! It's defined in the CONTROLS unit.

Good luck again!
0
 
LVL 1

Expert Comment

by:Gabor
Comment Utility
Sorry, I forgot the 'syntax'.
You have to define a new control class. It has to have these two method:

procedure CMMouseEnter(var Msg: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;

The Msg parameter isn't relevant, because the message is sent to the control directly. By default it sends towards to his parent.
0
 

Author Comment

by:charry
Comment Utility
How many hiden functions are they.  Thanks alot.  I wish I knew about these before, it would have save me much time.

Thanks
Chuck
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now