Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calendar Control
Message
 
 
To
28/05/2003 19:12:31
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00793750
Message ID:
00793778
Views:
19
Paul,

You can create a calendar form on the fly by adding day classes at X,Y coordinates and that day class can have it's font attributes set based on the bookings. Here's a code fragment that will get you started, put this in a Form.Init() and run it:
ld1 = {^2003-1-1}

lnTop = -12
lnLeftOffset = 0

do while ld1 < {^2003-12-31}
   if ( ld1 = {^2003-7-1} )
      lnLeftOffset = 320
      lnTop = -12
   endif
   if ( day( ld1 ) = 1 )
      lnTop = lnTop + 13
   endif
   lnDayOfWeek = dow( ld1 )
   lnLeft = lnLeftOffset + ( lnDayOfWeek - 1 ) * 40
   if ( lnDayOfWeek = 1 )
      lnTop = lnTop + 13
   endif
   lcObjName = "lbl" + dtos( ld1 )
   this.AddObject( lcObjName, "label" )
   with evaluate( "this." + lcObjName )
      .Top = lnTop
      .Left = lnLeft
      .Caption = transform( day( ld1 ) )
      .FontBold = ( rand() > 0.95 ) && simulate a booking
      .Visible = .t.
   endwith
   ld1 = ld1 + 1
enddo

this.Height = lnTop + 30
this.Width = 640
If a class of your own is used you can do things like enable the click to display the actual booking record for that date etc.

>Im doing an app that will have a scheduling module to it for booking trips. what i need to do is display a calender along the lines of mscal.Then I need to scan a table for any bookings that month then change the day font of any dates that are booked to RED or something along those lines. Basically i need to graphically display a calendar on my date entry form with all bokked dates showing red or whatever..
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform