This is a calendar object for Visual FoxPro. Used with a date text box, it drops down a VFP calendar class for selecting dates. Author: Author: Allan Lindgren, Quentin Freeware 22K Last updated: 2005.05.20
This class library consist of a container with textbox and button. To use this classlib, place a cCalendarDate on a form and set the textbox.controlsource to date type control source such as a form property or data column. When the button receives a click event, a class Ocal is added to the form and displayed. If you set the lHoliday property to .t. and have the forms ShowToolTips, holidays will be displayed in yellow and a tool tip will display for what the holiday is. the holidays are maintained in a table called holidays. Currently they go through 2005 and are mostly North American holidays. Do your own maintenance on this table. You may also want to add code to the form click or got focus to remove the oCal object such as
if type("thisform.oCal")="O"
thisform.removeobject("oCal")
endif
this zip has the class library and a form to demonstrate the cCalendarDate class.
I did not create this entirerly on my own and would give credit but it was so long ago I don't remember who had the original concept.
I have made improvements and mad this easy to use on forms so for that I take credit.
Allan Lindgren, Developer
akl@alindco.com
20 May 2005
updated:
1) checkthe accessibility of the "holidays.dbf", if it is not in search path or cannot be opened, the holiday will just skipped without error.
2) beautify the code
3) in setcal, calendar object, add Sun (red)
4) setcal is not Y2K compliant ( function ctod() is used), changed to use date()
5) holiday is seeked only if "holidays" dbf is used
6) holiday seek wrongly, fixed
7) lstMonths can be in-invisible if lblMonthYear clicked again
8) fixed the lsMonths
9) calendar (oCal) will position within the form.
10) ccalendardate will resize itself to make sure the button cmdArrowbutton will shown on the form
11) throught the assign method of ccalendardate.value, can initially set the value of txtdate
12) in cmdArrowButton.click, check the classlib is loaded or not before set classlib (only load if not loaded)
13) the oCal positioning only if the oCal is exist
Teddy Quentin Chung, Developer
quentin.chung@programmer.com.hk
To-do:
1) the calendar (oCal), will auto resize according the resolution 20 May 2005
correcto no baja nada tan bueno que parecia el post
ReplyDelete