Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OnMouseEnter/OnMouseExit-Event

20 views
Skip to first unread message

Udo Weik

unread,
Jan 13, 2001, 6:08:35 PM1/13/01
to
To whom it may concern,

I miss an OnMouseEnter/OnMouseExit-Event in all
visible components.

Any comments?


Thank you.

Udo Weik
Engineering Office, Germany

Martin Stainsby

unread,
Jan 13, 2001, 7:47:36 PM1/13/01
to
There is a example component on the borland.pubilc.attachments newsgroup
under the heading

"CBuilder example for SeonJoo Lee MouseEnter / Leave"


Martin Stainsby

unread,
Jan 13, 2001, 7:51:38 PM1/13/01
to
Components dont have mouseleave and mouseenter as standard but you can make
a new component from an existing component and add these functions


Udo Weik

unread,
Jan 14, 2001, 12:36:49 PM1/14/01
to
Hello Martin,

> There is a example component on the borland.pubilc.attachments newsgroup
> under the heading
>
> "CBuilder example for SeonJoo Lee MouseEnter / Leave"

Unfortunately, I can't find the example in the newsgroup.

Remy Lebeau

unread,
Jan 14, 2001, 3:02:12 PM1/14/01
to
First, you have to derive your own component, the standard ones don't
natively support what you're looking for.

Then, once you have that, here's how you add those events yourself:


class TMyComponent : public TWhateverBaseClassYouUse
{
private:
void __fastcall CMMouseEnter(TMessage&);
void __fastcall CMMouseLeave(TMessage&);
protected:
TNotifyEvent FOnMouseOver;
TNotifyEvent FOnMouseOut;
public:
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(CM_MOUSEENTER, TMessage, CMMouseEnter)
VCL_MESSAGE_HANDLER(CM_MOUSELEAVE, TMessage, CMMouseLeave)
END_MESSAGE_MAP(TWhateverBaseClassYouUse)

__property TNotifyEvent OnMouseOver = {read=FOnMouseOver,
write=FOnMouseOver};
__property TNotifyEvent OnMouseOut = {read=FOnMouseOut,
write=FOnMouseOut};
};

void __fastcall TMyComponent::CMMouseEnter(TMessage&)
{
if(FOnMouseOver)
FOnMouseOver(this);
}

void __fastcall TMyComponent::CMMouseLeave(TMessage&)
{
if(FOnMouseOut)
FOnMouseOut(this);
}


Gambit


"Udo Weik" <WeikE...@aol.com> wrote in message
news:3A60DFF3...@aol.com...

Martin Stainsby

unread,
Jan 14, 2001, 7:10:10 PM1/14/01
to
It was posted

01/01/2001 20:09

I believe it's still on the attachments newsgroup


Martin Stainsby

unread,
Jan 14, 2001, 7:06:00 PM1/14/01
to
Reme your a good man


Andrew

unread,
Jan 17, 2001, 12:17:09 PM1/17/01
to
Hello,


Create your own label. To add MouseOver and MouseOut insert the following
code:

class ColorLabel : public TLabel


{
private:
void __fastcall CMMouseEnter(TMessage&);
void __fastcall CMMouseLeave(TMessage&);
protected:
TNotifyEvent FOnMouseOver;

TNotifyEvent FoMouseOut;


public:
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(CM_MOUSEENTER, TMessage, CMMouseEnter)
VCL_MESSAGE_HANDLER(CM_MOUSELEAVE, TMessage, CMMouseLeave)

END_MESSAGE_MAP(TLabel)
__published
__property TNotifyEvent OnMouseOver = {read = FOnMouseOver,


write=FOnMouseOver};
__property TNotifyEvent OnMouseOut = {read = FOnMouseOut,
write=FOnMouseOut};
}

void __fastcall TColorLabel::CMMouseEnter(TMessage&)
{
if(FOnMouseOver)
FOnMouseOver(this);
}

void __fastcall TColorLabel::CMMouseLeave(TMessage&)
{
if(FOnMouseOut)
FOnMouseOut(this);
}


Martin Stainsby

unread,
Jan 17, 2001, 4:18:24 PM1/17/01
to
I've put a couple of examples on my website

http://homepage.ntlworld.com/mstainsby


0 new messages