Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - How to properly remember calendar's state?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to properly remember calendar's state?

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

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post Topic: How to properly remember calendar's state?
    Posted: 28 September 2009 at 6:05pm
Hello,

What is the proper way to remember what state the control was in, so that it can be restored to the same view type when re-starting the app?

Currently, I get the view type (GetCalendarCtrl().GetActiveView()->GetViewType()) and store it in the registry and in OnInitialUpdate I get that value and change the view type, however, that only works for Month. If I had Day or Full Week selected and stored, it will reset to Week view for some reason.

Any advice appreciated...

Thanks.
// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 28 September 2009 at 8:11pm

DayView and WorkWeekView should be similar to MonthView. For WeekView and FullWeekView you need to store and retrive flag MultiColumn mode and use it before switch.

To switch to desired ViewType follow CalendarDemoView.cpp code:

void OnCalendarViewDay();

void OnCalendarViewWorkWeek();

void OnCalendarViewWeek();

void OnCalendarViewMonth();

Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post Posted: 29 September 2009 at 9:10am
Not quite there yet - once I started strong the MultiColumn mode, I've moved a bit forward, however, if I try to store Day or any Week that's not 5 days, it resets to a 5 day week (work week).

I'll investigate a bit more, but there're places in the code like the following that make me a bit confused:

void CXTPCalendarControl::SwitchActiveView(XTPCalendarViewType eViewType)
{
    if (eViewType == xtpCalendarFullWeekView)
        eViewType = xtpCalendarWeekView;

    m_eViewType = eViewType;
// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 29 September 2009 at 7:19pm
This is proper as FullWeekView IS WeekView and adjustments for MultiColumn mode - in next piece of same function code:
........................
else if (eViewType == xtpCalendarWeekView) {

if (m_bMultiColumnWeekMode) {.....

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.156 seconds.