Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - [solved]How to alter the default date on view?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[solved]How to alter the default date on view?

 Post Reply Post Reply
Author
Message
u8702656 View Drop Down
Groupie
Groupie


Joined: 03 September 2009
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote u8702656 Quote  Post ReplyReply Direct Link To This Post Topic: [solved]How to alter the default date on view?
    Posted: 15 September 2009 at 5:55am
How to alter the default date on view?
Must use CXTPDatePickerControl ?
If it is true, how should I use it?
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: 16 September 2009 at 12:40pm
I don't understand that default mean but if you want to use your own init screen date - use e.g.
 

void CCalendarDemoView::OnInitialUpdate()  { ............

GetCalendarCtrl().GetActiveView()->ShowDay(COleDateTime(2009,12,1,0,0,0)); }

Back to Top
u8702656 View Drop Down
Groupie
Groupie


Joined: 03 September 2009
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote u8702656 Quote  Post ReplyReply Direct Link To This Post Posted: 16 September 2009 at 11:25pm
I use xtpCalendarWorkWeekView.
 
m_ctrlCalendar.GetActiveView()->ShowDay() is not work on WeekView mode.
 
It will alter the display mode as DayView .
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: 17 September 2009 at 8:48am
So for your case add another line:

void CCalendarDemoView::OnInitialUpdate()  { ............

GetCalendarCtrl().GetActiveView()->ShowDay(COleDateTime(2009,12,1,0,0,0));

OnCalendarViewWeek(); }

and you will have Week View with your date inside visible range
Back to Top
u8702656 View Drop Down
Groupie
Groupie


Joined: 03 September 2009
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote u8702656 Quote  Post ReplyReply Direct Link To This Post Posted: 17 September 2009 at 11:10pm
Thank you for reminding, I have solved my problem.
 
I use Calendar on dialog base .
 
The following is my OnInitDialog() code.
 
..........................
m_ctrlCalendar.SetTheme(new CXTPCalendarThemeOffice2007());
 
 int nWWMask = xtpCalendarDayAllWeek;
 m_ctrlCalendar.SetWorkWeekMask(nWWMask);
 
 m_ctrlCalendar.SetWorkWeekMask(nWWMask);
 CXTPCalendarDayView* pDayView = DYNAMIC_DOWNCAST(CXTPCalendarDayView, m_ctrlCalendar.GetDayView());
 if (pDayView)
 {
  // show working days interval
  COleDateTime dtDayViewStart(2009,12,1,0,0,0);
  pDayView->ShowWorkingDays(dtDayViewStart);
 } 
COleDateTimeSpan spHalfHour(0,0,30,0);
 
 COleDateTime dtHour = (double)spHalfHour * (DWORD)0;
 COleDateTime dtEndHour = (double)spHalfHour * (DWORD)47;
         
 m_ctrlCalendar.SetWorkDayStartTime(dtHour.GetHour(), dtHour.GetMinute(), 0);
 m_ctrlCalendar.SetWorkDayEndTime(dtEndHour.GetHour(),dtEndHour.GetMinute(),0);
...............................
 
It is work.
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.