Board index » cppbuilder » How to catch when mouse leave control ?

How to catch when mouse leave control ?


2004-07-24 01:19:25 AM
cppbuilder89
To catch when mouse is over control i have override MouseMove event and
there i set bMouseover variable
in paint i use that variable value to draw Frame3D to give raised look.
i want to set it back when mouse is moved from control. (Something like
TSpeedButton mouseover)
 
 

Re:How to catch when mouse leave control ?

"ScOe" < XXXX@XXXXX.COM >wrote in message
Quote
To catch when mouse is over control i have override MouseMove event
<snip>
i want to set it back when mouse is moved from control.
A better way is to intercept the CM_MOUSEENTER and CM_MOUSELEAVE messages
instead.
Gambit
 

Re:How to catch when mouse leave control ?

Quote
A better way is to intercept the CM_MOUSEENTER and CM_MOUSELEAVE messages
instead.
Thanx ... this works as it should be ..


Gambit


 

{smallsort}

Re:How to catch when mouse leave control ?

Quote
A better way is to intercept the CM_MOUSEENTER and CM_MOUSELEAVE messages
instead.

i cant find help for CM_MOUSEENTER message ... where can i get list of other
messages i can use ?
Quote

Gambit


 

Re:How to catch when mouse leave control ?

"ScOe" < XXXX@XXXXX.COM >wrote in message
Quote
i cant find help for CM_MOUSEENTER message ...
They are not documented at all. They are for the VCL's internal use.
Quote
where can i get list of other messages i can use ?
Only in the VCL source code, if you have it installed.
Gambit
 

Re:How to catch when mouse leave control ?

Quote
They are not documented at all. They are for the VCL's internal use.

can i use standard WM_ messages ?
class PACKAGE TCBZIconObject : public TCustomControl
{
...
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER (WM_LBUTTONUP, TWMMouse, MouseLeftClick) //this one is
never triggered
END_MESSAGE_MAP (TCustomControl)
Quote

Gambit



 

Re:How to catch when mouse leave control ?

"ScOe" < XXXX@XXXXX.COM >wrote in message
Quote
can i use standard WM_ messages ?
Yes, for the most part. There are some considerations, though.
For instance, if you are going to use the WM_NOTIFY or WM_COMMAND messages
then use CN_NOTIFY and CN_COMMAND instead, respectively. This is because
those WM_... messages are sent to the component's Parent window rather than
the component directly. The Parent will repackage the WM_... messages as
CN_... messages so that the component can handle its own messages directly.
Also, for mouse messages, it's generally better to override the approach
methods that TControl exposes, rather than catching the messages directly.
Quote
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER (WM_LBUTTONUP, TWMMouse, MouseLeftClick) //this one is
never triggered
END_MESSAGE_MAP (TCustomControl)
For instance, override the virtual MouseUp() method instead of catching the
WM_LBUTTONUP messages directly:
protected:
DYNAMIC void __fastcall MouseUp(TMouseButton Button, TShiftState
Shift, int X, int Y);
void __fastcall TMyControl::MouseUp(TMouseButton Button, TShiftState
Shift, int X, int Y)
{
// do something before default handling...
// default handling...
TCustomControl::MouseUp(Button, Shift, X, Y);
// do something after default handling...
}
Gambit