Пример #1
1
void AFXAPI DDX_MonthCalCtrl(CDataExchange* pDX, int nIDC, CTime& value)
{
    HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
    CMonthCalCtrl* pWnd = (CMonthCalCtrl*) CWnd::FromHandle(hWndCtrl);

    ENSURE(pWnd);
    if (pDX->m_bSaveAndValidate)
    {
        pWnd->GetCurSel(value);
    }
    else
    {
        pWnd->SetCurSel(value);
    }
}
Пример #2
0
/////////////////////////////////////////////////////////////////////////////
// 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 );
		}
	}
}
Пример #3
0
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);	
}
Пример #4
0
void AFXAPI DDX_MonthCalCtrl(CDataExchange* pDX, int nIDC,
                             FILETIME& value)
{
    SYSTEMTIME st;

    HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
    CMonthCalCtrl* pWnd = (CMonthCalCtrl*) CWnd::FromHandle(hWndCtrl);

    ENSURE(pWnd);
    if (pDX->m_bSaveAndValidate)
    {
        pWnd->GetCurSel(&st);
        SystemTimeToFileTime(&st, &value);
    }
    else
    {
        FileTimeToSystemTime(&value, &st);
        pWnd->SetCurSel(&st);
    }
}
Пример #5
0
void AFXAPI DDV_MinMaxMonth(CDataExchange* pDX,	COleDateTime& refValue,
                            const COleDateTime* pMinRange, const COleDateTime* pMaxRange)
{
    ASSERT(pMinRange == NULL || pMaxRange == NULL || *pMinRange <= *pMaxRange);
    CMonthCalCtrl* pWnd = (CMonthCalCtrl*) pDX->m_pDlgWnd->GetDlgItem(pDX->m_idLastControl);

    if (!pDX->m_bSaveAndValidate)
    {
        if ( (pMinRange != NULL && *pMinRange > refValue) ||
                (pMaxRange != NULL && *pMaxRange < refValue))
        {
            TRACE(traceAppMsg, 0, "Warning: initial dialog data is out of range in "
                  "control ID %d.\n", pDX->m_idLastControl);

            return;     // don't stop now
        }
    }

    ENSURE(pWnd);
    pWnd->SetRange(pMinRange, pMaxRange);
}