// if up or down has been clicked, pass it on to the scrolling code void CCustomListRowWnd::OnKeyDown(UINT32 nChar, UINT32 nRepCnt, UINT32 nFlags) { if(nChar == CAMKEY(DOWN) && m_RowNum + 1 < m_Parent->m_RowCount) m_Parent->SelectRow(m_RowNum+1); else if(nChar == CAMKEY(UP) && m_RowNum - 1 >= 0) m_Parent->SelectRow(m_RowNum-1); CWnd::OnKeyDown(nChar, nRepCnt, nFlags); }
BOOL HelpContents() { #ifndef STANDALONE // If F1 was pressed, popup help in the context of the current tool. Use the tool's OpToken (of // the form "TOOL<ToolId>") to look-up its help page. Fixes #10489 if (KeyPress::IsKeyPressed(CAMKEY(F1))) { String OpToken; OpToken._MakeMsg( _T("TOOL%u"), Tool::GetCurrentID() ); DWORD dwHelpIndex = LookupOperationTopic(OpToken); return ShowHelp(HELP_CONTEXT, dwHelpIndex); } return ShowHelp(HELP_FINDER, 0); #else // STANDALONE // On the viewer go directly to the contents page on all OS's #ifdef WEBSTER return ShowHelp(HELP_CONTEXT, _R(IDH_Contents)); #else //WEBSTER return ShowHelp(HELP_CONTEXT, _R(IDH_Misc_Contents)); #endif // WEBSTER #endif // STANDALONE }
static LRESULT CALLBACK EXPORT F1HookProc(INT32 nCode, WPARAM wParam, LPARAM lParam) { // Check if it's the F1 key going down within a dialog box . . . LPMSG lpmsg = (LPMSG) lParam; BOOL fHandleOK = ::IsWindow(lpmsg->hwnd); if (nCode == MSGF_DIALOGBOX && lpmsg->message == WM_KEYDOWN && lpmsg->wParam == CAMKEY(F1)) { // Simulate the help button within the dialog being clicked, if there is one. // Empirically I have discovered that the window handle contained within the // message is that of the first child window in the dialog. if (fHandleOK) FakeHelpButtonClick(::GetParent(lpmsg->hwnd)); } // Pass this event on to the next hook proc if it's valid. return (fHandleOK) ? ::CallNextHookEx(hF1Hook, nCode, wParam, lParam) : 0; }
// respond to mousewheel events by paging or scrolling accordingly BOOL CCustomList::OnMouseWheel(UINT32 nFlags, short zDelta, CPoint pt) { SCROLLINFO si; si.cbSize = sizeof(SCROLLINFO); si.fMask = SIF_TRACKPOS|SIF_PAGE|SIF_RANGE; GetVScrollBar()->GetScrollInfo(&si); INT32 nStep = GetKeyState(CAMKEY(CONTROL))<0 ? si.nPage : ROWHEIGHT ; INT32 newPos = GetVScrollBar()->GetScrollPos() - nStep*zDelta/WHEEL_DELTA; // force to zero if the first line would appear partially off screen if(newPos < ROWHEIGHT) newPos = 0; // keep the upper limit within bounds if(newPos > si.nMax) newPos = si.nMax; if (m_ScrollableArea) { m_ScrollableArea->HandleScrollMessage(SB_THUMBPOSITION, newPos); } return CWnd::OnMouseWheel(nFlags, zDelta, pt); }