Print Page | Close Window

How to properly remember calendar's state?

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=15259
Printed Date: 09 May 2024 at 5:55pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to properly remember calendar's state?
Posted By: dennisV
Subject: How to properly remember calendar's state?
Date 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)



Replies:
Posted By: mdoubson
Date 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();



-------------
Mark Doubson, Ph.D.


Posted By: dennisV
Date 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)


Posted By: mdoubson
Date 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) {.....



-------------
Mark Doubson, Ph.D.



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