> Message: 3         
>    Date: Mon, 01 Aug 2005 03:38:36 -0000
>    From: "pri_sama" <[EMAIL PROTECTED]>
> Subject: Detecting mouse leave
> 
> Hello !
> 
>   I have a component in which speed buttons are
> placed on a 
> TCustomPanel object. The speed buttons are invisible
> until the mouse 
> comes over it. I do this by using 'MouseMove' event
> of TCustomPanel. I 
> make the buttons invisible again by using the
> 'MouseLeave' event of 
> each button. This works fine on English XP machines.
> But when run on 
> Japanese XP machines, when the mouse is moved very
> fast over the 
> component the speed buttons remain visible. The
> reason is that 
> the 'MouseLeave' event is not fired in these
> occasions(I think the 
> MouseLeave event only fires when the button is
> visible and in this 
> occasion when the button becomes visible the mouse
> has gone out of the 
> button's bounds). Is there another way of knowing
> the mouse is out of 
> scope of the buttons ? (Delphi 5) 
> 
> 
=== message truncated ===

HI Pri,
In your custom panel have a 
property ActiveButton : TSpeedButton read
FActiveButton write SetActiveButton;

procedure TCustomPanel.SetActiveButton(Value :
TSpeedButton)

begin
  if FActiveButton <> Value then begin
    if FActiveButton <> nil then begin
      FActiveButton.Visible := false;
      //other leave button activities
    end;

    FActiveButton := Value;
    if FActiveButton <> nil then begin
      FActiveButton.visible := true;
      //other enter button activities

    end;

  end;

end;

procedure TCustomPanel.OnMouseMove(Sender : TObject;
ShiftState : TShiftState; X, Y : integer);

begin
  //called by button OnMouseMove
  if Sender is TSpeedButton then 
    ActiveButton := TSpeedButton(sender) else
    //called by CustomPanel OnMouseMove
    if Sender = ButtonPanel then 
      ActiveButton := nil else

//anything else you want to do
end;


With other methods working with mouse move you need to
set a border and if mouse is within that border its
either entering or leaving.

My method moves logic back to the parent.

mick




                
____________________________________________________ 
Do you Yahoo!? 
Yahoo! Photos: Now with unlimited storage 
http://au.photos.yahoo.com


------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12hbr82n0/M=362335.6886445.7839731.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1122945100/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/";>In
 low income neighborhoods, 84% do not own computers. At Network for Good, help 
bridge the Digital Divide!</a>.</font>
--------------------------------------------------------------------~-> 

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to