本文整理汇总了C++中CEdit::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ CEdit::Clear方法的具体用法?C++ CEdit::Clear怎么用?C++ CEdit::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEdit
的用法示例。
在下文中一共展示了CEdit::Clear方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetTestChildEditText
void CWindowFind::SetTestChildEditText(HWND hwnd,int iIndex)
{
HWND hwndChind = NULL;
CString strTemp = "";
TCHAR szClassName[256]={0};
int i = 1;
hwndChind = GetWindow(hwnd,GW_CHILD);
CWnd *pWnd = CWnd::FromHandle(hwndChind);
while (pWnd)
{
memset(szClassName,0,sizeof(szClassName));
hwndChind = pWnd->GetSafeHwnd();
GetClassName(hwndChind,(LPTSTR)&szClassName,256);
if ((CString)szClassName == "Edit")
{
if (iIndex == 0)
{
strTemp.Format("test%d",i);
}
else
{
if (i == iIndex)
{
strTemp.Format("te11111111st%d",i);
}
}
CopyStringToClipboard(NULL,strTemp);
CEdit *pCob = (CEdit *)CWnd::FromHandle(hwndChind);
if (pCob)
{
//先删除原有号码后向号码输入框发送复制消息
if (iIndex == 0)
{
pCob->SetSel(0, -1);
pCob->Clear();
::PostMessage(hwndChind,WM_PASTE,0,0);
}
else
{
if (i == iIndex)
{
pCob->SetSel(0, -1);
pCob->Clear();
::PostMessage(hwndChind,WM_PASTE,0,0);
}
}
}
}
pWnd = pWnd->GetNextWindow(GW_HWNDNEXT);
i++;
}
}
示例2: PreTranslateMessage
BOOL CVenusDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: 在此添加专用代码和/或调用基类
if(pMsg->wParam==VK_RETURN || pMsg->wParam==VK_ESCAPE)
{
// 隐藏窗体
SetShowStatus(false);
CString txt;
GetDlgItemText(IDC_EDIT1, txt);
if (pMsg->wParam == VK_RETURN)
{
// ctrl + enter 百度搜索输入的关键字
if (GetAsyncKeyState(VK_CONTROL)<0)
{
CString url;
url.Format("www.baidu.com/s?wd=%s", txt);
ShellExecute(NULL, _T("open"), _T(url), NULL, NULL, SW_SHOWNORMAL);
}
// shift + enter 查询DICT字典
else if (GetAsyncKeyState(VK_SHIFT)<0)
{
CString url;
url.Format("dict.cn/%s", txt);
ShellExecute(NULL, _T("open"), _T(url), NULL, NULL, SW_SHOWNORMAL);
}
// 仅回车时执行当前匹配到快捷程序
else
{
if (!lastKey.IsEmpty())
{
CString exePath = myIndex->GetLocalPath(lastKey);
if (lastKey == ";lnk")
{
system(exePath);
}
else
{
RunLnkFile((LPSTR)(LPCSTR)exePath);
}
}
}
}
// 清空输入内容
CEdit *myInput = (CEdit *)GetDlgItem(IDC_EDIT1);
myInput->SetSel(0, -1);
myInput->Clear();
return FALSE;
}
return CDialogEx::PreTranslateMessage(pMsg);
}
示例3: GetEditCtrl
// @pymethod int|PyCEdit|Clear|Clears all text in an edit control.
static PyObject *
PyCEdit_clear(PyObject *self, PyObject *args)
{
CHECK_NO_ARGS(args);
CEdit *pEdit = GetEditCtrl(self);
if (!pEdit )
return NULL;
GUI_BGN_SAVE;
pEdit->Clear(); // @pyseemfc CEdit|Clear
GUI_END_SAVE;
RETURN_NONE;
}
示例4: SetEditText
void CWindowFind::SetEditText(HWND hwnd,CString strValue)
{
TCHAR szClassName[256]={0};
GetClassName(hwnd,(LPTSTR)&szClassName,256);
if ((CString)szClassName == "Edit")
{
CopyStringToClipboard(NULL,strValue);
CEdit *pCob = (CEdit *)CWnd::FromHandle(hwnd);
if (pCob)
{
pCob->SetSel(0, -1);
pCob->Clear();
::PostMessage(hwnd,WM_PASTE,0,0);
}
}
}
示例5: PreTranslateMessage
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);
}