Solved

Detecting mouse over a button

Posted on 1997-04-16
2
409 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
[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
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…

738 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