void CAgentMonitorDlg::OnBnClickedButton2() { CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT2); pEdit->SetSel(0, -1, TRUE); pEdit->Copy(); pEdit->SetSel(-1, -1, TRUE); }
void CBasicView::OnEditCopy() { CEdit* pEdit = (CEdit*)GetFocus(); if (IsEdit( pEdit)) { pEdit->Copy(); } }
// @pymethod |PyCEdit|Copy|Copys the current selection to the clipboard. static PyObject *PyCEdit_copy(PyObject *self, PyObject *args) { CHECK_NO_ARGS(args); CEdit *pEdit = GetEditCtrl(self); if (!pEdit) return NULL; GUI_BGN_SAVE; pEdit->Copy(); // @pyseemfc CEdit|Copy GUI_END_SAVE; RETURN_NONE; }
BOOL CXTComboBoxEx::PreTranslateMessage(MSG* pMsg) { CEdit* pEditCtrl = GetEditCtrl(); if (pEditCtrl && ::IsWindow(pEditCtrl->m_hWnd)) { if (pMsg->message == WM_KEYDOWN) { if (::GetKeyState(VK_CONTROL) < 0) { switch (pMsg->wParam) { case 'a': case 'A': pEditCtrl->SetSel(0, -1); return TRUE; case 'c': case 'C': pEditCtrl->Copy(); return TRUE; case 'x': case 'X': pEditCtrl->Cut(); return TRUE; case 'v': case 'V': pEditCtrl->Paste(); return TRUE; } } else { if (::GetKeyState(VK_CLEAR)) { pEditCtrl->Clear(); return TRUE; } } } } return CComboBox::PreTranslateMessage(pMsg); }
void CNamingTreeCtrl::OnCopy() { // TODO: Add your command handler code here CNamingObject* pObject = GetTreeObject(); try { CString IOR = m_pORB->object_to_string(pObject->Object()); // Copy to the clipboard by using the CEdit control. This is easier // that doing it the right way CEdit Temp; CRect None(0,0, 1, 1); Temp.Create(0, None, this, 0); Temp.SetWindowText(IOR); Temp.SetSel(0, IOR.GetLength()); Temp.Copy(); Temp.PostMessage(WM_CLOSE); } catch(CORBA::Exception& ex) { MessageBox(ACE_TEXT_CHAR_TO_TCHAR (ex._rep_id()), ACE_TEXT ("CORBA::Exception")); } }
BOOL CEditBar::PreTranslateMessage(MSG* pMsg) { CWnd* pWnd; CEdit* pEdit; if ( pMsg->message == WM_KEYDOWN ) { if ( ((CMainFrame*)AfxGetMainWnd())->GetActiveView()->PreTranslateMessage(pMsg) ) return TRUE; switch ( pMsg->wParam ) { case VK_RETURN: { tokenSetup=0; if(GetKeyState(VK_SHIFT)&0x1000) {tokenSetup = 2;} if(GetKeyState(VK_CONTROL)&0x1000){tokenSetup = 1;} pWnd = ((CMainFrame*)AfxGetMainWnd())->GetActiveView(); if ( pWnd ) pWnd->PostMessage(WM_USER+100 , 0 , 0 ); return TRUE; } case VK_TAB: { // Check we are in extending mode pEdit = (CEdit*)GetDlgItem(IDC_EDIT); if ( m_bExtending ) { // substitute word by new value if ( !m_posCurPos ) m_posCurPos= m_lstTabWords.GetHeadPosition (); CString strWord = m_lstTabWords.GetNext(m_posCurPos); CString str = m_strStartLine; str += strWord; str+= m_strEndLine; m_bExtendingChange = TRUE; pEdit->SetWindowText (str); pEdit->SetSel (m_strStartLine.GetLength () + strWord.GetLength (), m_strStartLine.GetLength () + strWord.GetLength ()); m_bExtendingChange = FALSE; return TRUE; } // ok, get current line, word etc CString strText; pEdit->GetWindowText (strText); if ( !strText.GetLength () ) return TRUE; int start, end; pEdit->GetSel (start, end); if ( end <= 0 || strText[end-1] == ' ') return TRUE; m_strEndLine = strText.Right(strText.GetLength() - end); strText = strText.Left(end); int cpos = strText.ReverseFind(' '); CString strWord; if ( cpos < 0 ) { strWord = strText; m_strStartLine.Empty (); } else { strWord = strText.Right(strText.GetLength () - cpos-1); m_strStartLine = strText.Left (cpos +1); } m_lstTabWords.RemoveAll (); // now find all words same as this one CSmcDoc* pDoc = (CSmcDoc*)((CMainFrame*)AfxGetMainWnd())->GetActiveDocument (); if ( !pDoc ) return TRUE; m_lstTabWords.AddHead(strWord ); POSITION pos = pDoc->m_lstTabWords.GetHeadPosition (); while ( pos ) { CString str = pDoc->m_lstTabWords.GetNext(pos); if ( !strnicmp(str, strWord, strWord.GetLength()) ) { m_lstTabWords.AddTail (str); } } if ( m_lstTabWords.GetCount () < 2 ) { m_lstTabWords.RemoveAll (); return TRUE; } m_bExtending = TRUE; m_posCurPos = m_lstTabWords.GetHeadPosition(); m_lstTabWords.GetNext (m_posCurPos); strWord = m_lstTabWords.GetNext (m_posCurPos); strText = m_strStartLine + strWord + m_strEndLine; m_bExtendingChange = TRUE; pEdit ->SetWindowText (strText); int selpos = m_strStartLine.GetLength () + strWord.GetLength (); pEdit->SetSel (selpos, selpos); m_bExtendingChange = FALSE; return TRUE; } break; case VK_UP: if ( GetKeyState(VK_CONTROL) >= 0 ) { PrevLine(); return TRUE; } else return FALSE; case VK_DOWN: if ( GetKeyState(VK_CONTROL) >= 0 ) { NextLine(); return TRUE; } else return FALSE; case 'C': if ( GetKeyState(VK_CONTROL)&0x1000){ pEdit = (CEdit*)GetDlgItem(IDC_EDIT); pEdit->Copy(); return TRUE; } break; case VK_DELETE: if ( GetKeyState(VK_SHIFT)&0x1000){ pEdit = (CEdit*)GetDlgItem(IDC_EDIT); pEdit->Cut(); return TRUE; } break; case 'X': if ( GetKeyState(VK_CONTROL)&0x1000){ pEdit = (CEdit*)GetDlgItem(IDC_EDIT); pEdit->Cut(); return TRUE; } break; case VK_INSERT: if ( GetKeyState(VK_CONTROL)&0x1000){ pEdit = (CEdit*)GetDlgItem(IDC_EDIT); pEdit->Copy(); return TRUE; } if ( GetKeyState(VK_SHIFT)&0x1000){ /*pEdit = (CEdit*)GetDlgItem(IDC_EDIT); pEdit->Paste();*/ DoPaste(); return TRUE; } break; case 'V': if ( GetKeyState(VK_CONTROL)&0x1000){ /*pEdit = (CEdit*)GetDlgItem(IDC_EDIT); pEdit->Paste();*/ DoPaste(); return TRUE; } break; default: break; }; } if ( pMsg->message == WM_SYSKEYDOWN ) { if ( ((CMainFrame*)AfxGetMainWnd())->GetActiveView()->PreTranslateMessage(pMsg) ) return TRUE; } return CDialogBar::PreTranslateMessage(pMsg); }
bool CStudio::EventProcess(const Event &event) { CWindow* pw; CEdit* edit; CSlider* slider; if ( m_dialog != SD_NULL ) // dialogue exists? { return EventDialog(event); } if ( event.type == EVENT_FRAME ) { EventFrame(event); } pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3)); if ( pw == nullptr ) return false; edit = static_cast<CEdit*>(pw->SearchControl(EVENT_STUDIO_EDIT)); if ( edit == nullptr ) return false; if ( event.type == pw->GetEventTypeClose() ) { Event newEvent = event; newEvent.type = EVENT_STUDIO_OK; m_event->AddEvent(newEvent); } if ( event.type == EVENT_STUDIO_EDIT ) // text modifief? { ColorizeScript(edit); } if ( event.type == EVENT_STUDIO_LIST ) // list clicked? { m_main->StartDisplayInfo(const_cast<char *>(m_helpFilename.c_str()), -1); // TODO change to std::string when RobotMain changes } if ( event.type == EVENT_STUDIO_NEW ) // new? { m_script->New(edit, ""); } if ( event.type == EVENT_STUDIO_OPEN ) // open? { StartDialog(SD_OPEN); } if ( event.type == EVENT_STUDIO_SAVE ) // save? { StartDialog(SD_SAVE); } if ( event.type == EVENT_STUDIO_UNDO ) // undo? { edit->Undo(); } if ( event.type == EVENT_STUDIO_CUT ) // cut? { edit->Cut(); } if ( event.type == EVENT_STUDIO_COPY ) // copy? { edit->Copy(); } if ( event.type == EVENT_STUDIO_PASTE ) // paste? { edit->Paste(); } if ( event.type == EVENT_STUDIO_SIZE ) // size? { slider = static_cast< CSlider* >(pw->SearchControl(EVENT_STUDIO_SIZE)); if ( slider == nullptr ) return false; m_main->SetFontSize(9.0f+slider->GetVisibleValue()*12.0f); ViewEditScript(); } if ( event.type == EVENT_STUDIO_TOOL && // instructions? m_dialog == SD_NULL ) { m_main->StartDisplayInfo(SATCOM_HUSTON, false); } if ( event.type == EVENT_STUDIO_HELP && // help? m_dialog == SD_NULL ) { m_main->StartDisplayInfo(SATCOM_PROG, false); } if ( event.type == EVENT_STUDIO_COMPILE ) // compile? { if ( m_script->GetScript(edit) ) // compile { std::string res; GetResource(RES_TEXT, RT_STUDIO_COMPOK, res); SetInfoText(res, false); } else { std::string error; m_script->GetError(error); SetInfoText(error, false); } } if ( event.type == EVENT_STUDIO_RUN ) // run/stop? { if ( m_script->IsRunning() ) { Event newEvent = event; newEvent.type = EVENT_OBJECT_PROGSTOP; m_event->AddEvent(newEvent); // stop } else { if ( m_script->GetScript(edit) ) // compile { SetInfoText("", false); Event newEvent = event; newEvent.type = EVENT_OBJECT_PROGSTART; m_event->AddEvent(newEvent); // start } else { std::string error; m_script->GetError(error); SetInfoText(error, false); } } } if ( event.type == EVENT_STUDIO_REALTIME ) // real time? { m_bRealTime = !m_bRealTime; m_script->SetStepMode(!m_bRealTime); UpdateFlux(); UpdateButtons(); } if ( event.type == EVENT_STUDIO_STEP ) // step? { m_script->Step(event); } if ( event.type == EVENT_KEY_DOWN ) { if ( event.key.key == m_main->GetInputBinding(INPUT_SLOT_CBOT).primary || event.key.key == m_main->GetInputBinding(INPUT_SLOT_CBOT).secondary ) { if ( m_helpFilename.length() > 0 ) { m_main->StartDisplayInfo(const_cast<char *>(m_helpFilename.c_str()), -1); // TODO change to std::string when RobotMain changes } } } if ( event.type == EVENT_WINDOW3 ) // window is moved? { m_editActualPos = m_editFinalPos = pw->GetPos(); m_editActualDim = m_editFinalDim = pw->GetDim(); m_main->SetWindowPos(m_editActualPos); m_main->SetWindowDim(m_editActualDim); AdjustEditScript(); } if ( event.type == pw->GetEventTypeReduce() ) { if ( m_bEditMinimized ) { m_editFinalPos = m_main->GetWindowPos(); m_editFinalDim = m_main->GetWindowDim(); m_bEditMinimized = false; m_bEditMaximized = false; } else { m_editFinalPos.x = 0.00f; m_editFinalPos.y = -0.44f; m_editFinalDim.x = 1.00f; m_editFinalDim.y = 0.50f; m_bEditMinimized = true; m_bEditMaximized = false; } m_main->SetEditFull(m_bEditMaximized); pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3)); if ( pw != nullptr ) { pw->SetMaximized(m_bEditMaximized); pw->SetMinimized(m_bEditMinimized); } } if ( event.type == pw->GetEventTypeFull() ) { if ( m_bEditMaximized ) { m_editFinalPos = m_main->GetWindowPos(); m_editFinalDim = m_main->GetWindowDim(); m_bEditMinimized = false; m_bEditMaximized = false; } else { m_editFinalPos.x = 0.00f; m_editFinalPos.y = 0.00f; m_editFinalDim.x = 1.00f; m_editFinalDim.y = 1.00f; m_bEditMinimized = false; m_bEditMaximized = true; } m_main->SetEditFull(m_bEditMaximized); pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3)); if ( pw != nullptr ) { pw->SetMaximized(m_bEditMaximized); pw->SetMinimized(m_bEditMinimized); } } return true; }
void CTwisterDialog::OnCopyButton() { CEdit* pEditResult = (CEdit*) GetDlgItem(IDC_RESULT_BOX); pEditResult->SetSel(0,-1); pEditResult->Copy(); }
void CBibitemView::OnEditCopy() { CEdit* edit = GetFocusEdit(); if (edit) edit->Copy(); }
BOOL LListCtrl::PreTranslateMessage(MSG* pMsg) { // If edit control is visible in tree view control, sending a // WM_KEYDOWN message to the edit control will dismiss the edit // control. When ENTER key was sent to the edit control, the parent // window of the tree view control is responsible for updating the // item's label in TVN_ENDLABELEDIT notification code. if ( pMsg->message == WM_KEYDOWN ) { CHAR ckey=toupper( pMsg->wParam &0xFF ); if ( VK_RETURN == pMsg->wParam ) m_bEditNext = TRUE; if ( VK_ESCAPE == pMsg->wParam ) m_bEditNext = FALSE; if( GetKeyState( VK_CONTROL )<-1 && (ckey== 'A') ) { SelectAll(); return TRUE; } if( GetKeyState( VK_CONTROL )<-1 && (ckey== 'N') ) { SelectNone(); return TRUE; } CEdit* edit = GetEditControl(); if (edit) { // LTRACE("Control key status = %d %d\n",LOBYTE(GetKeyState( VK_CONTROL )),HIWORD(GetKeyState( VK_CONTROL ))); if( GetKeyState( VK_CONTROL )<-1 && (ckey== _T( 'C' ) ) ) { edit->Copy(); return TRUE; } if( GetKeyState( VK_CONTROL )<-1 && (ckey== _T( 'V' ) ) ) { edit->Paste(); return TRUE; } if( GetKeyState( VK_CONTROL )<-1 && (ckey== _T( 'X' ) ) ) { edit->Cut(); return TRUE; } if( GetKeyState( VK_CONTROL )<-1 && (ckey== _T( 'Z' ) ) ) { edit->Undo(); return TRUE; } if( pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE || pMsg->wParam == VK_CONTROL || pMsg->wParam == VK_INSERT || pMsg->wParam == VK_SHIFT ) { edit->SendMessage(WM_KEYDOWN, pMsg->wParam, pMsg->lParam); return TRUE; } } } return CListCtrl::PreTranslateMessage(pMsg); }