Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - SOLVED: adding own icons to events
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SOLVED: adding own icons to events

 Post Reply Post Reply
Author
Message
Alex H. View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 February 2004
Status: Offline
Points: 266
Post Options Post Options   Thanks (0) Thanks(0)   Quote Alex H. Quote  Post ReplyReply Direct Link To This Post Topic: SOLVED: adding own icons to events
    Posted: 05 August 2008 at 5:58am
How can i add and display my own icons in events?

This line doesn't work
ptrEvent->GetCustomIcons()->Add((UINT)IDI_MYICON);

Regards
Back to Top
AndreiM View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 18 August 2007
Status: Offline
Points: 132
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndreiM Quote  Post ReplyReply Direct Link To This Post Posted: 06 August 2008 at 2:04pm
At the first you have to add your icons (with IDs) to the image list: CXTPCalendarTheme::GetCustomIconsList()
See example in CAdvancedCalendarOptionsDlg::OnOK() implementation.
 
Then you have 2 ways to show custom icons:
 
  1. Add ID(s) to event object and update event in data provider.
          ptrEvent->GetCustomIcons()->Add((UINT)IDI_MYICON);
          ptrEvent->GetDataProvider()->ChangeEvent(ptrEvent);
          pCalendar->Populate();
 
  2. Set icon ID in XTP_NC_CALENDAR_PREPOPULATE event handler. In this case you don't need ChangeEvent and Populate calls.
          ptrEvent->GetCustomIcons()->AddIfNeed((UINT)IDI_MYICON);
      See example in CCalendarDemoView::OnEvent_PrePopulate.
Back to Top
Alex H. View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 February 2004
Status: Offline
Points: 266
Post Options Post Options   Thanks (0) Thanks(0)   Quote Alex H. Quote  Post ReplyReply Direct Link To This Post Posted: 07 August 2008 at 10:31am
Yes it works :-)

Thank you!
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.141 seconds.