Click here to Skip to main content
12,947,539 members (63,069 online)
Click here to Skip to main content
Add your own
alternative version


20 bookmarked
Posted 26 Oct 2002

Hovering Control Template

, 26 Oct 2002
Rate this:
Please Sign up or sign in to vote.
A template class to add hovering support to any control.

Sample Image - trackcontrol.jpg


This is a template class for creating hovering controls. It uses the _TrackMouseEvent method to recieve notifications regarding mouse events.

Using the code

To use it, you need to create a new class derived from the desired type (CButton, CEdit ...) and add the template code there. You also need to override 2 pure virtual functions: OnOverEnter() and OnHoverLeave(). Your class receives notifications via those functions. There is also a function called IsHover() which can return the hovering state.

In the demo project, I've created 2 simple classes: One derived from CButton and the other one derived from CEdit. They both react to mouse events.

#include "TrackControl.h"
class CHoverButton : public CTrackControl<CButton>
    virtual void OnHoverEnter()
    virtual void OnHoverLeave()


  • 10/27/2002 - First release


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Gilad Novik
Web Developer
Israel Israel
Gilad was born accidently to a pair of old lesbians. His childhood was full of vibrators and drugs. Married without kids. Has 14 grandsons around the world, 4 crocodiles, 2 mushrooms and a green alien living behind the refrigerator.

Hobbies: Watching hardcore porn, sculpturing with snot, skydiving from stairs.

Check my Homepage for additional resources.

Quote: "There's always one more bug"

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170518.1 | Last Updated 27 Oct 2002
Article Copyright 2002 by Gilad Novik
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid