Hi gurus,
To my view i added a horizontal and a vertical scrollbar.
They are both visible, but only the horizontal scrollbar sends WM_HSCROLL messages to the view when clicked on.
The vertical scrollbar does nothing when clicked on. How is this possible????
Both handlers and message maps are present. Breakpoint in OnHScroll() stops execution, but this does not work for OnVScroll().
Also spy++ does not record WM_VSCROLL messages.
This is how they are created:
This is how i draw them:Code:CMyView::OnCreate(LPCREATESTRUCT lpCreateStruct) { ... // Create scrollbars VERIFY(m_HorzScrollBar.Create(WS_CHILD|WS_VISIBLE|WS_HSCROLL, CRect(0,0,0,0), this, IDS_CTRL_HORZ_SB)); VERIFY(m_VertScrollBar.Create(WS_CHILD|WS_VISIBLE|WS_VSCROLL, CRect(0,0,0,0), this, IDS_CTRL_VERT_SB)); ... }
Code:void CMyView::OnDraw(CDC* pDC) { CDocument* pDoc = GetDocument(); // TODO: add draw code here CRect rcClient; GetClientRect(&rcClient); int iNewHeight = rcClient.bottom; int iNewWidth = rcClient.right; int iFolderTabWidth = m_FolderTabs.GetDesiredWidth(); int iFolderTabLimit = (iNewWidth*4) / 5; if(iFolderTabWidth > iFolderTabLimit) iFolderTabWidth = iFolderTabLimit; m_FolderTabs.MoveWindow(0, iNewHeight - GetSystemMetrics(SM_CYHSCROLL), iFolderTabWidth, GetSystemMetrics(SM_CYHSCROLL), TRUE); // reposition and redraw the horizontal scroll bar m_HorzScrollBar.MoveWindow( iFolderTabWidth, iNewHeight - GetSystemMetrics(SM_CYHSCROLL), iNewWidth - iFolderTabWidth - GetSystemMetrics(SM_CXVSCROLL), GetSystemMetrics (SM_CYHSCROLL), TRUE); // reposition and redraw the horizontal scroll bar m_VertScrollBar.MoveWindow( iNewWidth - GetSystemMetrics(SM_CYHSCROLL), rcClient.top, GetSystemMetrics(SM_CYHSCROLL), iNewHeight - GetSystemMetrics(SM_CYHSCROLL), TRUE); SCROLLINFO si; ZeroMemory (&si, sizeof (SCROLLINFO)); si.cbSize = sizeof (SCROLLINFO); si.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; si.nMin = 0; si.nMax = 10; si.nPos = 5; si.nPage = 1; m_HorzScrollBar.SetScrollInfo (&si, TRUE); m_VertScrollBar.SetScrollInfo (&si, TRUE); }





Reply With Quote