///////////////////////////////////////////////////////////////////////////// // CControlTreeDate message handlers // --- void CControlTreeDate::OnKillFocus( CWnd* pNewWnd ) { CDateTimeCtrl::OnKillFocus(pNewWnd); if ( !pNewWnd || !IsChild(pNewWnd) ) { CMonthCalCtrl *pMonthCtrl = GetMonthCalCtrl(); if ( !pMonthCtrl || pMonthCtrl->GetSafeHwnd() != pNewWnd->GetSafeHwnd() ) { CString str; GetWindowText( str ); // Send Notification to parent of ListView ctrl TV_DISPINFO dispinfo; dispinfo.hdr.hwndFrom = GetParent()->GetSafeHwnd(); dispinfo.hdr.idFrom = GetDlgCtrlID(); dispinfo.hdr.code = TVN_ENDLABELEDIT; dispinfo.item.mask = TVIF_TEXT; dispinfo.item.hItem = m_hItem; dispinfo.item.pszText = m_bESC ? NULL : LPTSTR((LPCTSTR)str); dispinfo.item.cchTextMax = str.GetLength(); GetParent()->GetParent()->SendMessage( WM_NOTIFY, GetParent()->GetDlgCtrlID(), (LPARAM)&dispinfo ); PostMessage( WM_CLOSE ); } } }
void SHDataTimeCtrl::OnKillFocus(CWnd* pNewWnd) { CDateTimeCtrl::OnKillFocus(pNewWnd); CMonthCalCtrl* pm=GetMonthCalCtrl( ); if(pm==pNewWnd)return; CString str; GetTime(m_date); str=m_date.Format("%Y-%m-%d"); // Send Notification to parent of ListView ctrl LV_DISPINFO dispinfo; dispinfo.hdr.hwndFrom = GetParent()->m_hWnd; dispinfo.hdr.idFrom = GetDlgCtrlID(); dispinfo.hdr.code = LVN_ENDLABELEDIT; dispinfo.item.mask = LVIF_TEXT; dispinfo.item.iItem = m_iItem; dispinfo.item.iSubItem = m_iSubItem; dispinfo.item.pszText = m_bESC ? NULL : LPTSTR((LPCTSTR)str); dispinfo.item.cchTextMax = str.GetLength(); if (!m_bESC) GetParent()->GetParent()->SendMessage( WM_NOTIFY, GetParent()->GetDlgCtrlID(), (LPARAM)&dispinfo ); //DestroyWindow(); if(pm!=NULL) pm->SendMessage(WM_CLOSE, 0, 0); PostMessage(WM_CLOSE, 0, 0); // TODO: Add your message handler code here }
//------------------------------------------------------------------------ //! WM_KILLFOCUS message handler called when CDateTimeCtrl is loosing focus //! to other control. Used register that cell value editor should close. //! //! @param pNewWnd Pointer to the window that receives the input focus (may be NULL or may be temporary). //------------------------------------------------------------------------ void CGridEditorDateTimeCtrl::OnKillFocus(CWnd *pNewWnd) { CDateTimeCtrl::OnKillFocus(pNewWnd); if (GetMonthCalCtrl()==NULL) { // Special case when a dynamic CEdit is created (DTS_APPCANPARSE) if (pNewWnd == NULL || pNewWnd->GetParent()!=this) EndEdit(true); } }
void CAguraDateBox::OnKillFocus(CWnd* pNewWnd) { CDateTimeCtrl::OnKillFocus(pNewWnd); // TODO: Add your message handler code here CMonthCalCtrl *pMonthWnd = GetMonthCalCtrl(); if( !pMonthWnd ) { ::PostMessage(m_hWnd, WM_CLOSE, 0, 0); ::SendMessage(::GetParent(m_hWnd), WM_AGURADATEBOX_CHANGE, (WPARAM)m_nVK, (LPARAM)NULL); } }
void COptionTreeItemDate::OnKillFocus(CWnd* pNewWnd) { // Declare varaibles CMonthCalCtrl *mCal; // Validate if (m_otOption == NULL) { CDateTimeCtrl::OnKillFocus(pNewWnd); return; } // See if new window is tree of list if (m_otOption->IsChild(pNewWnd) == FALSE) { CDateTimeCtrl::OnKillFocus(pNewWnd); return; } // Get calendar mCal = GetMonthCalCtrl(); // If new focus is a the calendar, we are not really loosing focucs if (mCal != NULL) { if (pNewWnd->GetSafeHwnd() != mCal->GetSafeHwnd()) { // -- Mark focus m_bFocus = FALSE; // -- Commit changes CommitChanges(); } } else { // -- Mark focus m_bFocus = FALSE; // -- Commit changes CommitChanges(); } CDateTimeCtrl::OnKillFocus(pNewWnd); }
//----------------------------------------------------------------------------------------------- // Remember that PreTranslateMessage is only called by a message loop from inside a MFC program. // If the host is another program for an ActiveX, you can not use PreTranslateMessage! //----------------------------------------------------------------------------------------------- BOOL CAguraDateBox::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if( pMsg->message==WM_KEYDOWN ) { // Key if( pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE || pMsg->wParam == VK_TAB || pMsg->wParam == VK_DELETE ) { m_nVK = pMsg->wParam; CMonthCalCtrl *pMonthWnd = GetMonthCalCtrl(); if( !pMonthWnd ) ::PostMessage(m_hWnd, WM_CLOSE, 0, 0); } } return CDateTimeCtrl::PreTranslateMessage(pMsg); }