Red Background |
Post Reply |
Author | |
Boris
Senior Member Joined: 21 June 2007 Location: United Kingdom Status: Offline Points: 179 |
Post Options
Thanks(0)
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 |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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) |
|
Boris
Senior Member Joined: 21 June 2007 Location: United Kingdom Status: Offline Points: 179 |
Post Options
Thanks(0)
|
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 |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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 |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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
|
|
Boris
Senior Member Joined: 21 June 2007 Location: United Kingdom Status: Offline Points: 179 |
Post Options
Thanks(0)
|
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
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 |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Maybe if you make this call out of the loop- all will works faster?
wndDatePicker.RedrawControl
wndDatePicker.AttachToCalendar CalendarControl |
|
Boris
Senior Member Joined: 21 June 2007 Location: United Kingdom Status: Offline Points: 179 |
Post Options
Thanks(0)
|
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 |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
I also expectinig your reaction on - http://forum.codejock.com/forum_posts.asp?TID=14974&PID=52063#52063 please
|
|
Boris
Senior Member Joined: 21 June 2007 Location: United Kingdom Status: Offline Points: 179 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |