Print Page | Close Window

Event Background Color Problem.

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=10341
Printed Date: 01 October 2024 at 4:18pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Event Background Color Problem.
Posted By: prashant
Subject: Event Background Color Problem.
Date 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();
}



Replies:
Posted By: prashant
Date Posted: 25 April 2008 at 3:20am
DONT USE STATIC NUMBER :)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net