Пример #1
0
// http://www.stackoverflow.com/questions/1480873/cedit-control-mfc-placing-cursor-to-end-of-string-after-setwindowtext
void CEdit_MoveToEnd(CEdit &ctrlEdit)
{
    ASSERT(ctrlEdit.GetSafeHwnd() != NULL);
    if (ctrlEdit.GetSafeHwnd() == NULL)
        return;

    ctrlEdit.SetSel(0, -1);
    ctrlEdit.SetSel(-1);
}
Пример #2
0
void CLATEDView::OnRename() 
{
    CTreeCtrl& rTree = GetTreeCtrl();

    HTREEITEM hItem = rTree.GetSelectedItem();
    if(hItem == NULL) {
        return;
    }

	CEdit* pEdit = rTree.EditLabel(hItem);
    TRACE("Edit hwnd: %x\n", pEdit->GetSafeHwnd());
}
Пример #3
0
void MyDlg_Search::OnSize(UINT nType, int cx, int cy)
{
	CDialog::OnSize(nType, cx, cy);

	// TODO: 在此处添加消息处理程序代码

	CEdit * p;
	CRect rect;

	p = (CEdit *)GetDlgItem(IDC_EDIT1);

	if (IsWindow(p->GetSafeHwnd()))
	{
		p->GetWindowRect(&rect);
		ScreenToClient(&rect);
		::SetWindowPos(p->GetSafeHwnd(),NULL,0,0,cx-rect.left,rect.Height(),SWP_NOOWNERZORDER|SWP_NOMOVE );
	}
	p = (CEdit *)GetDlgItem(IDC_EDIT2);

	if (IsWindow(p->GetSafeHwnd()))
	{
		p->GetWindowRect(&rect);
		ScreenToClient(&rect);
		::SetWindowPos(p->GetSafeHwnd(),NULL,0,0,cx-rect.left,rect.Height(),SWP_NOOWNERZORDER|SWP_NOMOVE );
	}
	p = (CEdit *)GetDlgItem(IDC_EDIT3);

	if (IsWindow(p->GetSafeHwnd()))
	{
		p->GetWindowRect(&rect);
		ScreenToClient(&rect);
		::SetWindowPos(p->GetSafeHwnd(),NULL,0,0,cx-rect.left,rect.Height(),SWP_NOOWNERZORDER|SWP_NOMOVE );
	}
}
Пример #4
0
BOOL CTabpageLend::PreTranslateMessage(MSG* pMsg)
{
	CEdit* pEditId = (CEdit*)GetDlgItem(IDC_EDIT_ID);
	CEdit* pEditGunId = (CEdit*)GetDlgItem(IDC_EDIT_GUN);
	if (pEditId != NULL && pMsg->hwnd == pEditId->GetSafeHwnd()
		&& VK_RETURN == pMsg->wParam)
	{
		CString id;
		pEditId->GetWindowTextW(id);
		DoIDInput(id);
		return TRUE;
	}
	else if (pEditGunId != NULL && pMsg->hwnd == pEditGunId->GetSafeHwnd()
		&& VK_RETURN == pMsg->wParam)
	{
		CString gunId;
		pEditGunId->GetWindowTextW(gunId);
		DoGunIDInput(gunId);
		return TRUE;
	}
	return CDialogEx::PreTranslateMessage(pMsg);
}
Пример #5
0
BOOL CTabpageBorrow::PreTranslateMessage(MSG* pMsg)
{
	// TODO: Add your specialized code here and/or call the base class
	CEdit* pEditId = (CEdit*)GetDlgItem(IDC_EDIT_ID_IN_BORROW);
	CEdit* pEditGunId = (CEdit*)GetDlgItem(IDC_EDIT_GUN);
	if (pEditId != NULL && pMsg->hwnd == pEditId->GetSafeHwnd()
		&& VK_RETURN == pMsg->wParam)
	{
		CString id;
		pEditId->GetWindowTextW(id);
		DoIDInput(id);
		return TRUE;
	}
	else if (pEditGunId != NULL && pMsg->hwnd == pEditGunId->GetSafeHwnd()
		&& VK_RETURN == pMsg->wParam)
	{
		CString gunId;
		pEditGunId->GetWindowTextW(gunId);
		DoGunIDInput(gunId);
		return TRUE;
	}
	return CDialogEx::PreTranslateMessage(pMsg);
}
Пример #6
0
// CArbiReportDlg 消息处理程序
void CArbiReportDlg::OnSize(UINT nType, int cx, int cy) 
{
	CDialog::OnSize(nType, cx, cy);
	
	// TODO: Add your message handler code here
	CDialog::OnSize(nType, cx, cy);
	if (GetSafeHwnd())
	{
		CEdit * peditLog = (CEdit*)GetDlgItem(IDC_EDIT_LOG);
		if (peditLog->GetSafeHwnd())
		{
			CRect rect(0,0,cx,cy);
			peditLog->MoveWindow(&rect);
		}
	}
}