[solved]How to alter the default date on view? |
Post Reply |
Author | |
u8702656
Groupie Joined: 03 September 2009 Status: Offline Points: 13 |
Post Options
Thanks(0)
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?
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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)); } |
|
u8702656
Groupie Joined: 03 September 2009 Status: Offline Points: 13 |
Post Options
Thanks(0)
|
I use xtpCalendarWorkWeekView.
m_ctrlCalendar.GetActiveView()->ShowDay() is not work on WeekView mode.
It will alter the display mode as DayView .
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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 |
|
u8702656
Groupie Joined: 03 September 2009 Status: Offline Points: 13 |
Post Options
Thanks(0)
|
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.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |