Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - Event Background Color Problem.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Event Background Color Problem.

 Post Reply Post Reply
Author
Message
prashant View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 February 2007
Location: India
Status: Offline
Points: 165
Post Options Post Options   Thanks (0) Thanks(0)   Quote prashant Quote  Post ReplyReply Direct Link To This Post Topic: Event Background Color Problem.
    Posted: 23 April 2008 at 4:33am

Problem:
Whats wrong in following piece of code? I am sending color as a parameter COLORREF m_clrColor and expecting to see Event background in the color sent by function caller.
One more thing, this function is getting called n number of times from another function.

I can see events in various colors but not in the color sent be caller function.

Thanks in advance :)

Sample Code:

// Code for setting Legend color.
MyFunction(Param 1, param 2....,COLORREF m_clrColor)
{
static int iCount = 0;

   CXTPCalendarData * calendarData = GetCalendarCtrl().GetDataProvider();
   if ( calendarData )
   {
      // We are going to make a copy of our local list of event labels
      CXTPCalendarEventLabels * copyCalendarEventLabels
         = new CXTPCalendarEventLabels();
      
      copyCalendarEventLabels->InitDefaultValues();
     
      if ( copyCalendarEventLabels )
      {
         // Go through our local copy of the labels,
         // and make a copy
         {
            // Copy label
            CXTPCalendarEventLabel * copyEventLabel = new
               CXTPCalendarEventLabel( iCount,
               m_clrColor,
               "Prashant");
            if ( copyEventLabel )
            {
               // Add the event lable copy to the event label list.
               copyCalendarEventLabels->InsertAt( iCount,
                  copyEventLabel );
            }
            else
            {
               ASSERT( FALSE );
            }
           
           
            // Update the data provider with the event label copy
            calendarData->SetLabelList( copyCalendarEventLabels );
         }
      }
   }
   ptrEvent->SetLabelID(iCount);
   iCount++;

    if (!pCalendarData->AddEvent(ptrEvent))
   {
      ASSERT(FALSE);
      return;
   }
   GetCalendarCtrl().Populate();
}
Back to Top
prashant View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 February 2007
Location: India
Status: Offline
Points: 165
Post Options Post Options   Thanks (0) Thanks(0)   Quote prashant Quote  Post ReplyReply Direct Link To This Post Posted: 25 April 2008 at 3:20am
DONT USE STATIC NUMBER :)
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.109 seconds.