Print Page | Close Window

Red Background

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=14975
Printed Date: 07 July 2025 at 9:27am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Red Background
Posted By: Boris
Subject: Red Background
Date Posted: 14 August 2009 at 10:10am
Why does my calendar show a blank red background sometimes when I refresh. I cannot find any setting where Red or even an RGB value has been applied that would do this.
 
Regards to all,


-------------
Boris

Product: Xtreme SuitePro (ActiveX) version 16.4.0 16.3.1

Platform: Windows XP (32bit) - SP 3

Language: Visual Basic 6.0 SP6

VS 2005-2008-2010-2013



Replies:
Posted By: mdoubson
Date Posted: 15 August 2009 at 2:20am
Because you use obsolete version or recent version without proper flag set -
 
CalendarControl.DayView.EcoMode = True

- in MFC - BOOL CXTPCalendarDayView::m_bEcoMode;

//flag to use on screen drawing instead of memory bitmap manipulation

//(which restricted by 64K - sometimes it is not enough fo very many schedules case -

//and use too much memory on low-end PC)



-------------
Mark Doubson, Ph.D.


Posted By: Boris
Date Posted: 17 August 2009 at 4:34am
Hi
 
Version 13.1... I am using ecomode ... I note that this property is a long but used with a bool ???
 
 
I think I have spotted the problem but I don't know how to fix it!!!
 
My users have a screen which allows them to move forward events en masse that are in the past but are not complete. When they do this other user's application detect that an event has changed by means of a timer polling the database every 5000 millisecs.  All edits are placed into separate table for history reasons.
 
When the tidy up process is run the users see a massive red area in the calendar.
 
So:
 

On Local Error Resume Next
Dim rst As ADODB.Recordset
Dim IDQuery As String
If ModalFormsRunningCounter > 0 Then Exit Sub
Timer1.Enabled = False
Set rst = New ADODB.Recordset
         
 
IDQuery = "SELECT ID, startdatetime, pcname , actiontype  FROM EditedEvents where  (id > " & EditedID & ") order by 1 asc "
rst.Open IDQuery, conn, adOpenForwardOnly, adLockOptimistic
If Not rst.EOF Then
rst.MoveFirst
 Do
  CalendarControl.DataProvider.ClearCache
  CalendarControl.DataProvider.RetrieveDayEvents Format(rst.Fields(1), "dd/mm/yyyy")
                                                           
   EditedID = rst.Fields(0)
   Me.CalendarControl.Populate
   wndDatePicker.RedrawControl
   wndDatePicker.AttachToCalendar CalendarControl
   rst.MoveNext
 Loop Until rst.EOF
                             

End If
rst.Close
Timer1.Enabled = True
 
Basically this piece of code seems to be the cuplrit. Any ideas I have fiddled with it but it either loses it functionality or I make it worse?
 
Regards


-------------
Boris

Product: Xtreme SuitePro (ActiveX) version 16.4.0 16.3.1

Platform: Windows XP (32bit) - SP 3

Language: Visual Basic 6.0 SP6

VS 2005-2008-2010-2013


Posted By: mdoubson
Date Posted: 17 August 2009 at 8:29pm
dispinterface CalendarDayView
  [id(23), helpcontext(4622)] BOOL EcoMode;
 DISP_PROPERTY_ID(CXTPCalendarDayView, "EcoMode", 23, m_bEcoMode, VT_BOOL)
btw - I don't understand this code
If Not rst.EOF Then
rst.MoveFirst
 Do
  CalendarControl.DataProvider.ClearCache
  CalendarControl.DataProvider.RetrieveDayEvents Format(rst.Fields(1), "dd/mm/yyyy")
                                                           
   EditedID = rst.Fields(0)
   Me.CalendarControl.Populate
   wndDatePicker.RedrawControl
   wndDatePicker.AttachToCalendar CalendarControl
   rst.MoveNext
 Loop Until rst.EOF
                             
Looks like your only data will be taken in the end of loop - others will be lost.
Am I right?

End If
rst.Close


-------------
Mark Doubson, Ph.D.


Posted By: mdoubson
Date Posted: 17 August 2009 at 8:58pm
You right - VB ObjectBrowser show in this case long (!?)
so I changed:
 dispinterface CalendarDayView
 {
 properties:
  [id(23), helpcontext(4622)] boolean EcoMode;
  [id(25), helpcontext(4637)] boolean DraftMode;
  [id(26), helpcontext(4638)] boolean RepeatHeaderMode;
  [id(27), helpcontext(4639)] boolean DF_Mode;
  [id(28), helpcontext(4640)] boolean EcoAllDayMode;
 
and now VB ObjectBrowser show as Boolean - everybody happy
try https://forum.codejock.com/uploads/DemoVersion/CalendarControlUpdated.rar - https://forum.codejock.com/uploads/DemoVersion/CalendarControlUpdated.rar  please

 


-------------
Mark Doubson, Ph.D.


Posted By: Boris
Date Posted: 18 August 2009 at 7:09am
 
Hi,
 
Works for me.... I've colourised a few bits to make it clearer.. does that help?
 
rst.open QueryString, Connection, adOpenForwardOnly, adLockOptimistic ' open recordset
 
If Not rst.EOF Then ' ok something was returned from recordset cos we aren't at the end of the recordset

rst.MoveFirst
 Do
 
  CalendarControl.DataProvider.ClearCache
  CalendarControl.DataProvider.RetrieveDayEvents Format(rst.Fields(1), "dd/mm/yyyy") ' retrieve event from the recordset and update calendar
                                                            
   EditedID = rst.Fields(0) ' pass into variable id number of edited event as this is a unique number

   Me.CalendarControl.Populate
   wndDatePicker.RedrawControl
   wndDatePicker.AttachToCalendar CalendarControl

   rst.MoveNext ' retrieve next row of recordset
 
 Loop Until rst.EOF
End If
rst.Close
 


-------------
Boris

Product: Xtreme SuitePro (ActiveX) version 16.4.0 16.3.1

Platform: Windows XP (32bit) - SP 3

Language: Visual Basic 6.0 SP6

VS 2005-2008-2010-2013


Posted By: mdoubson
Date Posted: 18 August 2009 at 12:32pm
Maybe if you make this call out of the loop- all will works faster? 
   wndDatePicker.RedrawControl
   wndDatePicker.AttachToCalendar CalendarControl


-------------
Mark Doubson, Ph.D.


Posted By: Boris
Date Posted: 18 August 2009 at 12:34pm
Great minds... I am just testing that. Previously the clients only change very few records on each edit. However, when they run the clean up process this may be slowing things down. I'll be sure to let you know how I get on.
 
 
Regards
 
UPDATED
 
Yes that does seem to have remedied the problem. Taking the control updates out of the loop has worked. Similarly I have taken the clearcache out too.
 
Regards


-------------
Boris

Product: Xtreme SuitePro (ActiveX) version 16.4.0 16.3.1

Platform: Windows XP (32bit) - SP 3

Language: Visual Basic 6.0 SP6

VS 2005-2008-2010-2013


Posted By: mdoubson
Date Posted: 18 August 2009 at 12:39pm
I also expectinig your reaction on - http://forum.codejock.com/forum_posts.asp?TID=14974&PID=52063#52063 - http://forum.codejock.com/forum_posts.asp?TID=14974&PID=52063#52063  please

-------------
Mark Doubson, Ph.D.


Posted By: Boris
Date Posted: 20 August 2009 at 4:56am
Hi,
 
The problem has started re-occuring. I have also been experiencing crashes. Over and over and over the app crashes. Windows is whinging about being unable to write to memory.
 
The problem started to appear when a user moved a date from one slot to another. Then started to move lots of events around in a meaningless fashion. I eventually tracked the problem down to the PrePopulate code. I had a DoEvents statement in the For Each loop. By taking that out the Red background has gone away and the crashes have stopped.
 
Interesting this as I thought that the DoEvents statement was helping to keep the process from slowing down the application redrawing.
 
Regards


-------------
Boris

Product: Xtreme SuitePro (ActiveX) version 16.4.0 16.3.1

Platform: Windows XP (32bit) - SP 3

Language: Visual Basic 6.0 SP6

VS 2005-2008-2010-2013



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