Solved

Detecting mouse over a button

Posted on 1997-04-16
2
393 Views
Last Modified: 2010-05-18
Do you have a Delphi 1 component that is a button that can detect when the mouse is over it, please?
I have the "MsBitBtn" from the Delphi Super Page (http://sunsite.icm.edu.pl/delphi/) and it works fine but not when it is in a form that is scaled. {form width etc scaled and components in it scaled by MyForm.ScaleBy(screen.width, 640)}. The button need not be a BitButton, just an ordinary button will do but it must -
1. Behave like a normal button.
2. Produce an event when the mouse moves into it or moves within it. I can set a flag and ignore multiple OnMoves once the 'entry' has been detected.
3. Produce an event when the mouse moves out of it.
4. It must behave as if it is detecting the position of the mouse, not the crossing of the button boundary- ie it must be able to respond correctly to fast movement in or out without missing the move.
5. It must work in scaled forms.
The MsBitBtn works well (after removing its 'color change') and would give you an exact idea of what I need. It has source code but unfortunately not for its DLL. The ideal would be to write a DLL for MSBitBtn that works when scaled so all I have to do is replace the DLL.
Thanks for your help.
0
Comment
Question by:frog
2 Comments
 
LVL 1

Expert Comment

by:CFantin
ID: 1335407
Does a normal delphi button not work as it has a OnMouseMove event?
0
 
LVL 1

Accepted Solution

by:
bcrotaz earned 50 total points
ID: 1335408
Create a descendant.
Add two private procedures:

procedure MouseEnter(var Msg: TMessage); message CM_MOUSEENTER;
procedure MouseExit(var Msg: TMessage); message CM_MOUSELEAVE;

Fire an event in each procedure.
If you don't know how to do that, email me:
bryan@ctv.co.uk
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

910 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

25 Experts available now in Live!

Get 1:1 Help Now