void CGridCtrlEx::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { // TODO: Add your message handler code here and/or call default CCellID cell = GetFocusCell(); if (!IsValid(cell)) { CGridCtrl::OnKeyDown(nChar, nRepCnt, nFlags); return; } if (IsCTRLpressed()) { switch (nChar) { case 'F': OnFind(); return; } } else { switch (nChar) { case VK_F3: OnFindContinue(); return; } } CGridCtrl::OnKeyDown(nChar, nRepCnt, nFlags); }
void dlgFindReplace::FindNext() { if (btnFind->IsEnabled() && !txtFind->IsEmpty()) { wxCommandEvent ev; OnFind(ev); } }
BOOL CRefLogDlg::PreTranslateMessage(MSG* pMsg) { if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_F5) Refresh(); else if (pMsg->message == WM_KEYDOWN && (pMsg->wParam == VK_F3 || (pMsg->wParam == 'F' && (GetAsyncKeyState(VK_CONTROL) & 0x8000)))) OnFind(); return CResizableStandAloneDialog::PreTranslateMessage(pMsg); }
void OnCommand( HWND hWnd, WPARAM wParam ) { switch( LOWORD(wParam) ) { case 1001: if( HIWORD(wParam)==CBN_SELCHANGE ) { HWND hSimple = GetDlgItem( hWnd, 1001 ); HWND hDropDown = GetDlgItem( hWnd, 1002 ); HWND hDropList = GetDlgItem( hWnd, 1003 ); LRESULT nSel = SendMessage( hSimple, CB_GETCURSEL, 0, 0 ); SendMessage(hDropDown,CB_SETCURSEL,nSel,0); SendMessage(hDropList,CB_SETCURSEL,nSel,0); }else if( HIWORD(wParam)==CBN_EDITCHANGE ) { MessageBox(hWnd,"键盘输入内容有变化","Infor", MB_OK ); } break; case ID_DATA: OnData( hWnd );//获取选择项的附加数据 break; case ID_TEXT: OnText( hWnd );//获取选择项文本内容 break; case ID_FIND: OnFind( hWnd );//匹配选项 break; case ID_DELETE: OnDelete( hWnd );//删除选择项 break; case ID_CLEAR: OnClear( hWnd );//清空选项 break; case ID_ADD: OnAdd( hWnd );//添加选项 break; } }
void OnCommand(HWND hWnd,WPARAM wParam){ switch(LOWORD(wParam)){ case 1001: if(HIWORD(wParam) == CBN_SELCHANGE){ HWND hSimple = GetDlgItem(hWnd,1001); HWND hDropDown = GetDlgItem(hWnd,1002); HWND hDropList = GetDlgItem(hWnd,1003); LRESULT nRet = SendMessage(hSimple,CB_GETCURSEL,0,0); SendMessage(hDropDown,CB_SETCURSEL,nRet,0); SendMessage(hDropList,CB_SETCURSEL,nRet,0); } else if(HIWORD(wParam) == CBN_EDITCHANGE ){ MessageBox(hWnd,"Keyboard Input changes","Info",MB_OK); } break; case ID_DATA: OnData(hWnd); break; case ID_DIR: OnDir(hWnd); break; case ID_TEXT: OnText(hWnd); break; case ID_FIND: OnFind(hWnd); break; case ID_ADD: OnAdd(hWnd); break; case ID_CLEAN: OnClean(hWnd); break; case ID_DELETE: OnDelete(hWnd); break; } }
/* boolean findNext (); */ NS_IMETHODIMP nsWebBrowserFind::FindNext(bool *outDidFind) { NS_ENSURE_ARG_POINTER(outDidFind); *outDidFind = false; NS_ENSURE_TRUE(CanFindNext(), NS_ERROR_NOT_INITIALIZED); nsresult rv = NS_OK; nsCOMPtr<nsIDOMWindow> searchFrame = do_QueryReferent(mCurrentSearchFrame); NS_ENSURE_TRUE(searchFrame, NS_ERROR_NOT_INITIALIZED); nsCOMPtr<nsIDOMWindow> rootFrame = do_QueryReferent(mRootSearchFrame); NS_ENSURE_TRUE(rootFrame, NS_ERROR_NOT_INITIALIZED); // first, if there's a "cmd_findagain" observer around, check to see if it // wants to perform the find again command . If it performs the find again // it will return true, in which case we exit ::FindNext() early. // Otherwise, nsWebBrowserFind needs to perform the find again command itself // this is used by nsTypeAheadFind, which controls find again when it was // the last executed find in the current window. nsCOMPtr<nsIObserverService> observerSvc = mozilla::services::GetObserverService(); if (observerSvc) { nsCOMPtr<nsISupportsInterfacePointer> windowSupportsData = do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsISupports> searchWindowSupports = do_QueryInterface(rootFrame); windowSupportsData->SetData(searchWindowSupports); NS_NAMED_LITERAL_STRING(dnStr, "down"); NS_NAMED_LITERAL_STRING(upStr, "up"); observerSvc->NotifyObservers(windowSupportsData, "nsWebBrowserFind_FindAgain", mFindBackwards? upStr.get(): dnStr.get()); windowSupportsData->GetData(getter_AddRefs(searchWindowSupports)); // findnext performed if search window data cleared out *outDidFind = searchWindowSupports == nullptr; if (*outDidFind) return NS_OK; } // next, look in the current frame. If found, return. // Beware! This may flush notifications via synchronous // ScrollSelectionIntoView. rv = SearchInFrame(searchFrame, false, outDidFind); if (NS_FAILED(rv)) return rv; if (*outDidFind) return OnFind(searchFrame); // we are done // if we are not searching other frames, return if (!mSearchSubFrames && !mSearchParentFrames) return NS_OK; nsIDocShell *rootDocShell = GetDocShellFromWindow(rootFrame); if (!rootDocShell) return NS_ERROR_FAILURE; int32_t enumDirection; if (mFindBackwards) enumDirection = nsIDocShell::ENUMERATE_BACKWARDS; else enumDirection = nsIDocShell::ENUMERATE_FORWARDS; nsCOMPtr<nsISimpleEnumerator> docShellEnumerator; rv = rootDocShell->GetDocShellEnumerator(nsIDocShellTreeItem::typeAll, enumDirection, getter_AddRefs(docShellEnumerator)); if (NS_FAILED(rv)) return rv; // remember where we started nsCOMPtr<nsIDocShellTreeItem> startingItem = do_QueryInterface(GetDocShellFromWindow(searchFrame), &rv); if (NS_FAILED(rv)) return rv; nsCOMPtr<nsIDocShellTreeItem> curItem; // XXX We should avoid searching in frameset documents here. // We also need to honour mSearchSubFrames and mSearchParentFrames. bool hasMore, doFind = false; while (NS_SUCCEEDED(docShellEnumerator->HasMoreElements(&hasMore)) && hasMore) { nsCOMPtr<nsISupports> curSupports; rv = docShellEnumerator->GetNext(getter_AddRefs(curSupports)); if (NS_FAILED(rv)) break; curItem = do_QueryInterface(curSupports, &rv); if (NS_FAILED(rv)) break; if (doFind) { searchFrame = do_GetInterface(curItem, &rv); if (NS_FAILED(rv)) break; OnStartSearchFrame(searchFrame); // Beware! This may flush notifications via synchronous // ScrollSelectionIntoView. rv = SearchInFrame(searchFrame, false, outDidFind); if (NS_FAILED(rv)) return rv; if (*outDidFind) return OnFind(searchFrame); // we are done OnEndSearchFrame(searchFrame); } if (curItem.get() == startingItem.get()) doFind = true; // start looking in frames after this one }; if (!mWrapFind) { // remember where we left off SetCurrentSearchFrame(searchFrame); return NS_OK; } // From here on, we're wrapping, first through the other frames, // then finally from the beginning of the starting frame back to // the starting point. // because nsISimpleEnumerator is totally lame and isn't resettable, I // have to make a new one docShellEnumerator = nullptr; rv = rootDocShell->GetDocShellEnumerator(nsIDocShellTreeItem::typeAll, enumDirection, getter_AddRefs(docShellEnumerator)); if (NS_FAILED(rv)) return rv; while (NS_SUCCEEDED(docShellEnumerator->HasMoreElements(&hasMore)) && hasMore) { nsCOMPtr<nsISupports> curSupports; rv = docShellEnumerator->GetNext(getter_AddRefs(curSupports)); if (NS_FAILED(rv)) break; curItem = do_QueryInterface(curSupports, &rv); if (NS_FAILED(rv)) break; searchFrame = do_GetInterface(curItem, &rv); if (NS_FAILED(rv)) break; if (curItem.get() == startingItem.get()) { // Beware! This may flush notifications via synchronous // ScrollSelectionIntoView. rv = SearchInFrame(searchFrame, true, outDidFind); if (NS_FAILED(rv)) return rv; if (*outDidFind) return OnFind(searchFrame); // we are done break; } OnStartSearchFrame(searchFrame); // Beware! This may flush notifications via synchronous // ScrollSelectionIntoView. rv = SearchInFrame(searchFrame, false, outDidFind); if (NS_FAILED(rv)) return rv; if (*outDidFind) return OnFind(searchFrame); // we are done OnEndSearchFrame(searchFrame); } // remember where we left off SetCurrentSearchFrame(searchFrame); NS_ASSERTION(NS_SUCCEEDED(rv), "Something failed"); return rv; }