Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - Get column title
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Get column title

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


Joined: 24 February 2008
Status: Offline
Points: 45
Post Options Post Options   Thanks (0) Thanks(0)   Quote gmail Quote  Post ReplyReply Direct Link To This Post Topic: Get column title
    Posted: 08 September 2009 at 6:55pm
How can I set my own custom title name for e.g. first day in the week (i.e. on week view instead of 'Monday' I want to set 'Christmas')? Thanks for replying.
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: 14 September 2009 at 6:40pm

You can use: GetCalendarCtrl().m_bFullDateMode = TRUE;

CXTPCalendarDayView* pDayView = DYNAMIC_DOWNCAST(CXTPCalendarDayView, GetCalendarCtrl().GetDayView() );

if (pDayView) { pDayView->SetDayHeaderFormat(_T("Holiday %A, %B %d, %Y")); } - but it give you custom title for DayView or multi-column week view and every day will be Holiday (!). May be in next version we will make something for special title string for different days

Still you can use any combination of date-related C-format (%a %b ...)
But this is static (same for all days) custom text
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: 18 September 2009 at 9:53am
You can use notification - e.g.
VB Calendar Sample notification handler:
Private Sub CalendarControl_GetItemText(ByVal Params As XtremeCalendarControl.CalendarGetItemTextParams)
.............................................................................................
If Params.Item = xtpCalendarItemText_DayViewDayHeaderRight Or _
           Params.Item = xtpCalendarItemText_WeekViewDayHeaderRight Or _
           Params.Item = xtpCalendarItemText_MonthViewDayHeaderRight _
        Then
        Params.Text = Year(Params.ViewDay.Date) & " - Your happy day"
.............................................................................................   
End Sub

you need to add subscription to notification in your Form load function call

CalendarControl.AskItemTextFlags.SetFlag xtpCalendarItemText_DayViewDayHeaderRight
Samething you can use in MFC -

CString CXTPCalendarDayViewDay::GetCaption() {

COleDateTime dt(m_dtDate);

SYSTEMTIME st;

GETASSYSTEMTIME_DT(dt, st);

CString strHeaderFormat = GetView() ? GetView()->GetDayHeaderFormat() : _T("");

CString strResult = CXTPCalendarUtils::GetDateFormat(&st, strHeaderFormat);

if (strHeaderFormat.Find(_T("%")) > -1) //C-format used

strResult = dt.Format(strHeaderFormat);

DWORD dwFlags = XTP_SAFE_GET2(GetView(), GetCalendarControl(), GetAskItemTextFlags(), 0);

if (dwFlags & xtpCalendarItemText_DayViewDayHeader)

{

XTP_CALENDAR_GETITEMTEXT_PARAMS objRequest;

::ZeroMemory(&objRequest, sizeof(objRequest));

objRequest.nItem = (int)xtpCalendarItemText_DayViewDayHeader;

objRequest.pstrText = &strResult;

objRequest.pViewDay = this;

XTP_SAFE_CALL2(GetView(), GetCalendarControl(), SendNotificationAlways(

XTP_NC_CALENDAR_GETITEMTEXT, (WPARAM)&objRequest, 0));

}

return strResult;

}

Just use nofification XTP_NC_CALENDAR_GETITEMTEXT
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.172 seconds.