🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.pascal.delphi.misc
4 messages
4 total messages Started by Eric Fri, 30 Apr 1999 00:00
Hot to implement MouseEnter and MouseExit with SpeedButton ??
#438
Author: Eric
Date: Fri, 30 Apr 1999 00:00
19 lines
1969 bytes
Hello,

Would you please to give me a simple example to implement MouseEnter and
MouseExit on SpeedButton ????

Best regards,
Eric

--
     _                                                  _
    / ) |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ( \
   / /  |                                            |  \ \
 _( /_  | _   Chow Hoi Ka, Eric                    _ |  _) )_
(((\ \> |/ )                                      ( \| </ /)))
(\\\\ \_/ /   E-Mail : d951686@sftw.umac.mo        \ \_/ ////)
 \       /                                          \        /
  \    _/     http://www.sftw.umac.mo/~d951686/      \_     /
  /   / |____________________________________________| \    \
 /   /                                                   \    \
Re: Hot to implement MouseEnter and MouseExit with SpeedButton ??
#439
Author: Reid Roman
Date: Fri, 30 Apr 1999 00:00
40 lines
2276 bytes
Eric wrote:
> 
> Hello,
> 
> Would you please to give me a simple example to implement MouseEnter and
> MouseExit on SpeedButton ????


Use the onmousemove event for the form, this gives you the x and y
co-ordinates of the mouse pointer, something like:

procedure Tfrmnew.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
        if (x>=component1.left) and
(x<=component1.left+component1.width)
        and (y>=component1.top) and
(y<=component1.top+component1.height)
        then messagedlg('Over thecontrol',mtinformation,[mbok],0);
end;


HTH

-- 


                   \|||/
                   /'^'\
                  ( 0 0 )
--------------oOOO--(_)--OOOo--------------
. Reid Roman			          .
. Programmer / Analyst 	                  . 
. TVisualBasic := Class(None)	          .
. May the Source be With You		  .
-------------------------------------------
. Auto-By-Tel (http://www.autobytel.com)  .
. Irvine, CA U.S.A 			  .
. E-Mail : rkroman (at) home (dot) com    .
-------------------------------------------
Re: Hot to implement MouseEnter and MouseExit with SpeedButton ??
#440
Author: Dave Shapiro
Date: Fri, 30 Apr 1999 00:00
82 lines
3097 bytes
Reid Roman wrote:
> 
> Eric wrote:
> >
> > Hello,
> >
> > Would you please to give me a simple example to implement MouseEnter and
> > MouseExit on SpeedButton ????
> 
> Use the onmousemove event for the form, this gives you the x and y
> co-ordinates of the mouse pointer, something like:

This technique might not give you all the right results. For instance,
what if, on form creation, the cursor is inside the button? The event
doesn't get triggered immediately. If it's not too much of a pain (i.e.
you've already got a zillion TSpeedButtons created), you might consider
writing your own TSpeedButton descendent that traps the MOUSEENTER and
MOUSELEAVE message. Here's an example:


unit PsSpeedButton;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, Buttons;

type
  TPsSpeedButton = class(TSpeedButton)
  private
  protected
    FOnMouseEnter: TNotifyEvent;
    FOnMouseLeave: TNotifyEvent;
    procedure DoMouseEnter; virtual;
    procedure DoMouseLeave; virtual;
    procedure CMMouseEnter(var Msg: TMessage); message CM_MOUSEENTER;
    procedure CMMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;
  public
  published
    property OnMouseEnter: TNotifyEvent read FOnMouseEnter
                                        write FOnMouseEnter;
    property OnMouseLeave: TNotifyEvent read FOnMouseLeave
                                        write FOnMouseLeave;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Professional Software', [TPsSpeedButton]);
end;

procedure TPsSpeedButton.DoMouseEnter;
begin
  if Assigned(OnMouseEnter) then OnMouseEnter(Self);
end;

procedure TPsSpeedButton.DoMouseLeave;
begin
  if Assigned(OnMouseLeave) then OnMouseLeave(Self);
end;

procedure TPsSpeedButton.CMMouseEnter(var Msg: TMessage);
begin
  DoMouseEnter;
end;

procedure TPsSpeedButton.CMMouseLeave(var Msg: TMessage); 
begin
  DoMouseLeave;
end;

end.


Dave
-- 
http://www.csd.net/~daves
Re: Hot to implement MouseEnter and MouseExit with SpeedButton ??
#445
Author: Alan MacArthur
Date: Thu, 06 May 1999 00:00
23 lines
1988 bytes
Eric wrote:
> 
> Hello,
> 
> Would you please to give me a simple example to implement MouseEnter and
> MouseExit on SpeedButton ????
> 
> Best regards,
> Eric
> 
> --
>      _                                                  _
>     / ) |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ( \
>    / /  |                                            |  \ \
>  _( /_  | _   Chow Hoi Ka, Eric                    _ |  _) )_
> (((\ \> |/ )                                      ( \| </ /)))
> (\\\\ \_/ /   E-Mail : d951686@sftw.umac.mo        \ \_/ ////)
>  \       /                                          \        /
>   \    _/     http://www.sftw.umac.mo/~d951686/      \_     /
>   /   / |____________________________________________| \    \
>  /   /                                                   \    \

It's a private procedure.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads