Thanks in advance.
Ibrahim.
There not an OnMouseOver as such, but there is an event called OnMouseMove.
OnMouseOut does not either exist.
I wonder if it would be a good idea to add such events, because they are
useful.
Regards
Peter
not that hard, just derive a custom component and handle CM_MouseEnter and
CM_MouseLeave
johannes
--
Please reply in this newsgroup only
- SIP solutions -
http://www.sipsolutions.de/
Thanks, Johannes, but I meant Borland adding them to TForm.
Regards
Peter
Thanks again.
Ibrahim.
Johannes Berg wrote in message <39033CE9...@gmx.net>...
>> I wonder if it would be a good idea to add such events, because they are
>> useful.
>
>not that hard, just derive a custom component and handle CM_MouseEnter and
>CM_MouseLeave
>
hmm, actually, why not TWinControl?
> Thanks Johannes, but I was thinking of something simple. I am actually a
> beginner.
> If its possible for you, can you tell me how to derive a custom component.
You wanted a TLabel, right?
Create a new component by going File|New|component, name it TInOutLabel or
whatever you like, and base it on TLabel, fill in a proper filename and hit
OK.
Fill it like this:
}
unit uInOutLabel;
// created by Johannes Berg (joha...@sipsolutions.de)
// might not compile...
interface
uses ...;
type
TInOutLabel = component(TLabel)
private
FOnMouseEnter,
FOnMouseLeave : TNotifyEvent;
// if you leave out these lines Delphi will do its magic and
// stick them in when you hit CTRL-SHIFT-C (see below) ;-)
protected
procedure CMMouseEnter (var msg:tmessage); message cm_mouseenter;
procedure CMMouseLeave (var msg:tmessage); message cm_mouseleave;
published
property OnMouseEnter : TNotifyEvent read FOnMouseEnter
write FOnMouseEnter;
property OnMouseLeave : TNotifyEvent read FOnMouseLeave
write FOnMouseLeave;
// now put your cursor here and hit CTRL-SHIFT-C,
// you will automatically get the procedures CMMouseEnter&CMMouseLeave
// in the implementation section
end;
implementation
procedure TInOutLabel.CMMouseEnter(var msg:tmessage);
begin
if Assigned(FOnMouseEnter) then FOnMouseEnter(self);
end;
procedure TInOutLabel.CMMouseEnter(var msg:tmessage);
begin
if Assigned(FOnMouseLeave) then FOnMouseLeave(self);
end;
end.
Ok, since I put { } around the top you might as well just copy the whole post
I just wrote and save it as your unit <g>