<< Return to Main Index

< Return to Class Index

class CGXScrollTip: public CWnd

The CGXScrollTip class lets you display scroll tips when the user is dragging the scrollbar thumbs.

CGXScrollTip is only supported for MFC version 4.0 or higher.

To enable scroll tips for your grid, embed a CGXScrollTip object into your derived grid class. Furthermore, you have to process the WM_VSCROLL and WM_HSCROLL messages and dispatch this events to the CGXScrollTip object.

Example:

// declare in your class

CGXScrollTip m_ScrollTip;

// generate WM_VSCROLL and WM_HSCROLL message handler with ClassWizard

void CSampleWnd::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
   ROWCOL nRow = nPos*m_nVScrollFactor, nCol = 0;
   wsprintf(szText, _T("Row: %lu"), nRow);
   m_ScrollTip.HandleScrollMessage(this, nSBCode, SB_VERT, szText, pScrollBar);

   CGXGridWnd::OnVScroll(nSBCode, nPos, pScrollBar);
}

void CSampleWnd::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
   // ScrollTips
   ROWCOL nRow = 0, nCol = nPos*m_nHScrollFactor;
   wsprintf(szText, _T("Column: %lu"), nCol);
   m_ScrollTip.HandleScrollMessage(this, nSBCode, SB_HORZ, szText, pScrollBar);

   CGXGridWnd::OnHScroll(nSBCode, nPos, pScrollBar);
}

We also recommed that you turn off immediate scrolling of the grid when the user is dragging the scrollbar thumb. To do this, call

   GetParam()->EnableThumbTrack(FALSE);

#include <gxall.h>

See Also

CGXGridParam::EnableThumbTrack

CGXScrollTip

Class Members