Click here to Skip to main content
15,896,154 members
Articles / Desktop Programming / MFC
Article

CTimerScroll class

Rate me:
Please Sign up or sign in to vote.
3.50/5 (2 votes)
23 Jan 2001 52.1K   1.4K   17   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


    Written By
    Systems Engineer
    Venezuela Venezuela
    This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

    Comments and Discussions

     
    GeneralProblems Pin
    8-Mar-02 17:37
    suss8-Mar-02 17:37 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.