Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - Calendar Selection Bug Fixes.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Calendar Selection Bug Fixes.

 Post Reply Post Reply
Author
Message
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Topic: Calendar Selection Bug Fixes.
    Posted: 27 August 2013 at 4:37pm
These have been around for awhile and no official fix in sight so I thought I would share my fixes  to correct some pretty egregious errors.

1. Using Prev/Next arrows changes the view to Day. To maintain the correct view revert the code in file XTPCalendarThemePrevNextEventButton.cpp function
BOOL CTOPrevNextEventButton::OnLButtonDown(CCmdTarget* /*pObject*/, UINT /*nFlags*/, CPoint point, CTOPrevNextEventButtons *pButtons)

From:

            CXTPCalendarView* pNewView = GetTheme()->GetCalendarControl()->GetActiveView();
            pView = GetTheme()->GetCalendarControl()->GetActiveView();
            if (pView != pNewView)
            {
                pView = pNewView;
                if (pView && pView->GetViewType() != nViewType)
                    GetTheme()->GetCalendarControl()->SwitchActiveView(nViewType);
            }

To:

            pView = GetTheme()->GetCalendarControl()->GetActiveView();

            if (pView && pView->GetViewType() != nViewType)
                GetTheme()->GetCalendarControl()->SwitchActiveView(nViewType);

2. Toggle from timeline mode to standard sets calendar display to "Today".

Change the following code in file XTPCalendarControl.cpp function
void CXTPCalendarControl::OnCalendarTimeline()

From:
        COleDateTime dtNow(COleDateTime::GetCurrentTime());

        m_eViewType = viewtype; //prev view type
        if (viewtype == xtpCalendarDayView)
        {
            m_nTimelineScale = xtpTSPID_Day;
            dtNow -= COleDateTimeSpan(1,3,0,0);
        }
        else if (viewtype == xtpCalendarWorkWeekView)
        {
            m_nTimelineScale = xtpTSPID_WorkWeek;
            dtNow -= COleDateTimeSpan(5.0);
        }
        else if (viewtype == xtpCalendarWeekView)
        {
            m_nTimelineScale = xtpTSPID_Week;
            dtNow -= COleDateTimeSpan(7.0);
        }
        else if (viewtype == xtpCalendarMonthView)
        {
            m_nTimelineScale = xtpTSPID_Month;
            dtNow -= COleDateTimeSpan(11.0);
        }

To:
        COleDateTime dtNow(COleDateTime::GetCurrentTime());
        COleDateTime dtCurrent(dtNow);

        m_eViewType = viewtype; //prev view type
        if (viewtype == xtpCalendarDayView)
        {
            dtNow = ((CXTPCalendarDayView*)GetActiveView())->GetViewDayDate(0);
            m_nTimelineScale = xtpTSPID_Day;
            if (dtNow == dtCurrent)
                dtNow -= COleDateTimeSpan(1,3,0,0);
        }
        else if (viewtype == xtpCalendarWorkWeekView)
        {
            dtNow = ((CXTPCalendarWeekView*)GetActiveView())->GetViewDayDate(0);
            m_nTimelineScale = xtpTSPID_WorkWeek;
            if (dtNow == dtCurrent)
                dtNow -= COleDateTimeSpan(5.0);
        }
        else if (viewtype == xtpCalendarWeekView)
        {
            dtNow = ((CXTPCalendarWeekView*)GetActiveView())->GetViewDayDate(0);
            m_nTimelineScale = xtpTSPID_Week;
            if (dtNow == dtCurrent)
                dtNow -= COleDateTimeSpan(7.0);
        }
        else if (viewtype == xtpCalendarMonthView)
        {
            dtNow = ((CXTPCalendarMonthView*)GetActiveView())->GetViewDayDate(0);
            m_nTimelineScale = xtpTSPID_Month;
            if (dtNow == dtCurrent)
                dtNow -= COleDateTimeSpan(11.0);
        }

I hope this helps folks out and hopefully CJ will see fit to incorporate or improve upon these fixes in upcoming releases.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.