Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtDateTimeWnd Collapse All
Subject Author Date
Eddie Judson Oct 5, 2005 - 10:21 PM

Is it the default behaviour for the CExtDateTimeWnd when showing both a date and time that when you select a new date the time reverts to 12:00:00 am and if so is there a way to stop it doing that?  Also if the CExtDateTimeWnd is showing both a date and time say 9/09/2005 2:00:00 pm when you change the 2 to a 3;  pm changes to am can this be stopped also?


Regards,


       Eddie

Technical Support Oct 6, 2005 - 9:41 AM

Thank you for the bug report. We agree with you that when the user selects a date from the pop-up date picker, the time should not be changed. We already changed the default behavior. Please replace the CExtDateTimeWnd::OnDropDownCalendarSelChanged() method with this:

LRESULT CExtDateTimeWnd::OnDropDownCalendarSelChanged( WPARAM wParam, LPARAM lParam )

{
    ASSERT_VALID( this );
    lParam;
    const CExtDatePickerWnd::SELECTION_NOTIFICATION * pSN =
        CExtDatePickerWnd::SELECTION_NOTIFICATION::FromWPARAM( wParam );
    ASSERT( pSN != NULL );
    if( pSN->m_bFinalSelectionChanging )
    {
        if(       pSN->m_dtBegin.GetStatus() == COleDateTime::valid 
            &&    GetStatus() == CExtDateTimeWnd::valid
            )
            SetDateTime( 
                pSN->m_dtBegin.GetYear(),
                pSN->m_dtBegin.GetMonth(),
                pSN->m_dtBegin.GetDay(),
                m_dtDate.GetHour(),
                m_dtDate.GetMinute(),
                m_dtDate.GetSecond()
                );
        else
            SetDateTime( pSN->m_dtBegin );
    }
    return 0L;
}
As for the second problem, we confirm this bug. To fix it, please open the CExtDateTimeWnd::OnDigitPressed() method, find the case CExtDurationWnd::hour line and replace the corresponding code with this:
case CExtDurationWnd::hour:
    {
        bool b24Hours = OnQueryTimeFormat24Hours();
        if( nValue < 0 || nValue > 23 )
            nValue = nDigit;
        pII->m_nValue = nValue;
        if( !b24Hours )
        {
            if( nHour >= 12 && nValue < 12 )
                nValue += 12;
            if( pII->m_nValue > 12 )
                pII->m_nValue -= 12;
        }
        ASSERT( pII->m_nValue >= 0 
            && (   (pII->m_nValue <= 23 && b24Hours) 
                || (pII->m_nValue <= 12 && !b24Hours) )
            );
        ASSERT( nValue >= 0 && nValue <= 23 );
        nHour = nValue;
    }
    break;
After that recompile the library. These fixes will also be available in the next library release.