Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DBI ctSchedule doesn't actually clear time bars
Message
 
 
À
03/12/2013 12:32:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01589161
Message ID:
01589194
Vues:
39
>SSchedule - 40 (40+ was the name of the exe to install).
>
>I am using version 8.0. I am also having problems with setting bar text. No error- the bar text just never gets set. You are certainly welcome to examine the code and point out something that I may be missing:
>
>
>LPARAMETERS toScheduleObject
>LOCAL lnBarColor, liStartTime, liEndTime , liStartDate, liEndDate, lnI, lnBarNdx, liItmNdx
>*** Clear the time bars just in case the user selected a new start date
>*** Or Checks one of the boxes that says "View this event only" etc.
>*** The documentation says that the following should work, but in practice
>*** it does not - the call to ClearTimeBars() returns true, but they remain 
>*** visible in the scheduler, so get out the sledge hammer
>*!*	FOR lnI = 1 TO toScheduleObject.ListCount
>*!*		toScheduleObject.ClearTimeBars(lnI)
>*!*	ENDFOR 
>toScheduleObject.ClearSchedule()
>Thisform.Initializelistbar(toScheduleObject)
>DO CASE 
>	CASE toScheduleObject = Thisform.pgfSchedule.pgEvents.oSchedule.object
>		*** Get all the items in the list bar into a cursor in the same order that they are in the list bar
>		IF Thisform.chkThisEvent.value		
>			SELECT DISTINCT FullName FROM SchedulerService_V WHERE SrvEvtID = Thisform.CurrentEventID INTO CURSOR qTmp NOFILTER 
>		ELSE 
>			SELECT DISTINCT FullName FROM SchedulerService_V ORDER BY FullName INTO CURSOR qTmp NOFILTER 		
>		ENDIF
>		SCAN
>			liItmNdx = INT(RECNO('qTmp'))
>			*** Process all the events for that person
>			SELECT * FROM SchedulerService_V WHERE FullName == qTmp.Fullname INTO CURSOR Fred NOFILTER 
>			SCAN 
>				*** Need to add the case for "Non-Service" once I figure out what the heck that means
>				DO CASE 
>					CASE Fred.SrvEvtID = Thisform.CurrentEventID
>						lnBarColor = Thisform.shpThisEvent.BackColor
>					CASE Fred.ServiceID = Thisform.CurrentServiceid  
>						lnBarColor = Thisform.ShpThisService.BackColor
>					OTHERWISE
>						lnBarColor = Thisform.shpOtherService.BackColor
>				ENDCASE  
>				*** Make sure we actually have a scheduled event
>				IF NOT EMPTY(Fred.EvtTimeBeg) AND NOT EMPTY(SchedulerService_V.EvtTimeEnd) AND ;
>					NOT EMPTY(NVL(SchedulerService_V.EvtDateBeg, {})) AND NOT EMPTY(NVL(Fred.EvtDateEnd, {}))
>					*** Make the the event falls within the selected date range
>					liStartTime = (VAL(GETWORDNUM(Fred.EvtTimeBeg, 1, ':')) * 60) + VAL(GETWORDNUM(Fred.EvtTimeBeg, 2, ':'))
>					liEndTime = (VAL(GETWORDNUM(Fred.EvtTimeEnd, 1, ':')) * 60) + VAL(GETWORDNUM(Fred.EvtTimeEnd, 2, ':'))
>					liStartDate = Fred.EvtDateBeg - {^1900-01-01}
>					liEndDate = Fred.EvtDateEnd - {^1900-01-01}				
>					*** Make sure that at least part of the event occurs within the specified date range
>					IF liStartDate <= toScheduleObject.DateEnd AND liEndDate >= toScheduleObject.DateStart
>						IF NOT Thisform.chkThisEvent.Value
>							lnBarNdx = toScheduleObject.AddColorBar(liStartTime, liEndTime, liStartDate, liEndDate, lnBarColor, liItmNdx)
>							toScheduleObject.BarCargo[liItmNdx, lnBarNdx] = PADL(Fred.SrvEvtID, 10, ' ')
>							toScheduleObject.BarText[liItmNdx, lnBarNdx] = ALLTRIM(Fred.EvtTypeDesc)
>						ELSE 
>							IF Fred.SrvEvtID = Thisform.CurrentEventID
>								lnBarNdx = toScheduleObject.AddColorBar(liStartTime, liEndTime, liStartDate, liEndDate, lnBarColor, liItmNdx)
>								toScheduleObject.BarCargo[liItmNdx, lnBarNdx] = PADL(Fred.SrvEvtID, 10, ' ')
>								toScheduleObject.BarText[liItmNdx, lnBarNdx] = ALLTRIM(Fred.EvtTypeDesc)
>							ENDIF 
>						ENDIF 
>					ENDIF  
>				ENDIF 
>			ENDSCAN
>			SELECT qTmp
>		ENDSCAN 
>ENDCASE 
>
I took a quick look and seems Ok to me. I guess you were debugging it line by line and saw that executed, right?

I checked our code and I see the following - may be it will help
   lnBarID = loCT.AddKeyTimeBar(lnIndexID,;
       .numminute(start_time), .numminute(end_time),;
       .numdate(.dCurrentDate), .numdate(.dCurrentDate), booking_id)
      loCT.BarText(lnIndexID, lnBarID) = space(iif(layer=7 or locked,2,0))+alltrim(nvl(display_msg,'nulls present'))
      loCT.BarTextAlign(lnIndexID, lnBarID) = 0

      &&change the look to match the properties of the lesson
      if layer>0
        loCT.BarStyle(lnIndexID, lnBarID)=layer + iif(locked, 7, 0) + iif(notelength>0, 14, 0)
      endif
      
      loCT.BarBackColor(lnIndexID, lnBarID) = backcolor
      if backcolor=forecolor
        if backcolor=0				&&just so you can see it
          loCT.BarForeColor(lnIndexID, lnBarID) = rgb(255,255,255)
        else
          loCT.BarForeColor(lnIndexID, lnBarID) = 0
        endif
      else
        loCT.BarForeColor(lnIndexID, lnBarID) = forecolor
      endif
Also, I see that we have BarText set in BarAdded method of the schedule as well. Not sure, if it's important or not.

I worked on that form, but all the ctSchedule stuff was written by my colleagues before I started playing with it.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform