CTimerScroll class






3.50/5 (2 votes)
Jan 24, 2001

52209

1420
Helper class to handler the mouse cursor movement near to client's area borders
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:
Register(CWnd* pWnd)
- Registers the windows object to send messages to.Install()
- Installs the timer and captures the mouse cursorUnistall()
- Helper method to unistall the timer.
How to use
- Insert a
CTimerScroll
object in your CWnd derived class. - Invoke
Register
in your init creation process. For exampleOnInitialUpdate
,OnCreate
, .... - In the
OnLButtonDown
message handler, callInstall()
, this method capture the mouse for you. - In the
OnLButtonUp
message handler, callReleaseCapture
, 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).