Click here to Skip to main content
Licence 
First Posted 23 Jan 2001
Views 44,530
Bookmarked 16 times

CTimerScroll class

By | 23 Jan 2001 | Article
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

    About the Author

    José Alfredo Morón P.

    Systems Engineer

    Venezuela Venezuela

    Member



    Sign Up to vote   Poor Excellent
    Add a reason or comment to your vote: x
    Votes of 3 or less require a comment

    Comments and Discussions

     
    You must Sign In to use this message board. (secure sign-in)
     
    Search this forum  
     FAQ
        Noise  Layout  Per page   
      Refresh
    GeneralProblems PinmemberAnonymous17:37 8 Mar '02  

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

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

    Permalink | Advertise | Privacy | Mobile
    Web02 | 2.5.120517.1 | Last Updated 24 Jan 2001
    Article Copyright 2001 by José Alfredo Morón P.
    Everything else Copyright © CodeProject, 1999-2012
    Terms of Use
    Layout: fixed | fluid