Print Page | Close Window

Calendar Selection Bug Fixes.

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=21864
Printed Date: 25 April 2024 at 1:11am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Calendar Selection Bug Fixes.
Posted By: Algae
Subject: Calendar Selection Bug Fixes.
Date 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.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net