Board index » delphi » Checking the OnMouseOut event?

Checking the OnMouseOut event?

How do I check for the "OnMouseOut"-event, which is the event that I want
occurring
when the mouse pointer leaves a control frame (such as leaving a button or a
form).

So, to add for those that find me not making any sense, I want to know when
the mouse pointer
is moved from being on top of, for example, a button to not being on top of
that button.
(This is the direct opposite to the OnMouseMove-event for that button, which
occurs when the
mouse moves over it.)
 * Mouse moving onto a control makes the control issue an OnMouseMove event.
* Mouse moving away to an other control from the current control makes the
current control issue
an OnMouseOut event (or at least I want it to do so) and the new control
issues OnMouseMove.

Making any sense now?

Thanks for the help!

 

Re:Checking the OnMouseOut event?


"Supply and Demand" <m...@worldonline.se> wrote in message
news:dqIo9.1098$o4.43324@news010.worldonline.se...

Quote
> How do I check for the "OnMouseOut"-event, which is the event that I want
> occurring
> when the mouse pointer leaves a control frame (such as leaving a button or
a
> form).

How about doing this:

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
   if MouseOverButton then // global boolean flag
   begin
      ShowMessage('You are no longer over the button.');
      MouseOverButton := false;
   end;
end;

procedure TForm1.Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
    MouseOverButton := true;
end;

Re:Checking the OnMouseOut event?


On Tue, 8 Oct 2002 23:57:56 +0200, "Supply and Demand"

Quote
<m...@worldonline.se> wrote:
>How do I check for the "OnMouseOut"-event, which is the event that I want
>occurring
>when the mouse pointer leaves a control frame (such as leaving a button or a
>form).

>So, to add for those that find me not making any sense, I want to know when
>the mouse pointer
>is moved from being on top of, for example, a button to not being on top of
>that button.
>(This is the direct opposite to the OnMouseMove-event for that button, which
>occurs when the
>mouse moves over it.)
> * Mouse moving onto a control makes the control issue an OnMouseMove event.
>* Mouse moving away to an other control from the current control makes the
>current control issue
>an OnMouseOut event (or at least I want it to do so) and the new control
>issues OnMouseMove.

>Making any sense now?

>Thanks for the help!

If the control descends from TControl, you can trap the CM_MOUSEENTER
and CM_MOUSELEAVE component messages to get when the mouse moves over
or away from the control.  You'll need to create a descendant control
that provides message handlers (and possibly events) for these.  

Stephen Posey
slpo...@concentric.net

Other Threads