Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

CTimerScroll class

0.00/5 (No votes)
23 Jan 2001 1  
Helper class to handler the mouse cursor movement near to client's area borders
  • Download source files - 3 Kb
  • Download demo project - 31 Kb
  • Sample Image - TimerScroll.gif

    Introduction

    This class is useful for scrolling CWnd derived objects, for example CScrollView, and helps you to handle mouse cursor movement near the client's border. The CTimerScroll object sends WM_HSCROLL and WM_VSCROLL messages to your object.

    It has only 3 methods:

    1. Register(CWnd* pWnd) - Registers the windows object to send messages to.
    2. Install() - Installs the timer and captures the mouse cursor
    3. Unistall() - Helper method to unistall the timer.

    How to use

    1. Insert a CTimerScroll object in your CWnd derived class.
    2. Invoke Register in your init creation process. For example OnInitialUpdate, OnCreate, ....
    3. In the OnLButtonDown message handler, call Install(), this method capture the mouse for you.
    4. In the OnLButtonUp message handler, call ReleaseCapture, to release the mouse. This unistall the timer automatically.

    Of course you must handle the scrolling messages.

    Sample code

    The TSSample sample is a MFC SDI VC++6 aplication sample, and uses the CTimerScroll. The TSSampleView is derived from CScrollView (this MFC class have scroll handler methods build in).

    License

    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