TGregCalendar ============= Version 1.06 (20 December 1996) Freeware for Delphi 1.0 and 2.0 Copyright (c) 1996 Greg Lief ---------------------------------------------------------------------------- 1. Description 2. Installation 3. New Properties 4. New Method 5. New Event 6. Copyright Notice 7. Disclaimer 8. Technical Support 9. Revision History 10. Comments ---------------------------------------------------------------------------- 1. Description ============== Delphi includes a nice calendar component (TCalendar) on the Samples component page. Although it handles much of the grunt work for us, TCalendar has some glaring deficiencies, the biggest of which is the user's inability to navigate beyond the currently displayed month. Plugging that hole was the original intent of the TGregCalendar component, which includes a customized KeyDown method that handles the following keys: PgUp, PgDn, Ctrl-PgUp, Ctrl-PgDn, arrows. (The user can also right-click upon the calendar to navigate by month and year.) However, I have also added some other niceties, including the ability to change the color for the selected date and attach a label which will display the current month and year. There is a built-in popup menu which allows the user another way to navigate through the calendar. You can also display the current month and year in the caption of the form upon which the calendar resides (via the UseFormCaption property). Last, but far from least, you can also designate "special days", which can display icons or bitmaps and have associated text. 2. Installation =============== A. Choose the Component | Install menu option (or if you are using Delphi 1.0, the Options | Install Components menu option). B. Click upon the Add Button, and select either GCAL16.DCU (Delphi 1) or GCAL32.DCU (Delphi 2). C. Press OK twice. D. After your component library is recompiled, you will find a new tab entitled "Greg Lief", with the TGregCalendar icon upon it. The included DEMO.ZIP file contains a sample project that uses TGregCalendar, along with several supporting icons and bitmaps. 3. New Properties ================= Except as noted, all properties are available at design-time. Caption -- This is a TLabel component which, if used, will be updated with the current calendar month and year as the user navigates. CenterDates -- This dictates whether or not to center the dates within each cell. If you set this to False, the dates will be displayed in the lower-right corner of the cells, which I feel is preferable when you are using special days (see below). CloseOnDoubleClick -- If set to True, a double-click upon the calendar will cause the form upon which it resides to close. This is ideal when you are using the calendar in a pop-up date entry dialog. Menu -- If you plug a menuitem into this property, the navigation items on the popup menu will be added to that menuitem. This is useful if you want to the user to be able to navigate within the menu from an existing menu. SelectedBGColor -- This color will be used to draw the background of the currently selected date cell. The default is clHighlight. SelectedFGColor -- This color is used to draw the currently selected date (i.e., the number). The default is clWhite. SpecialDays (run-time only) -- This is a list of special days. Each special day can have an attached icon or bitmap, as well as descriptive text. As written, the text will be displayed to the user in the form of the calendar's Hint property. (See the AddSpecialDay method below for instructions on how to create special days.) UseFormCaption -- If set to True, the current calendar month and year will be continuously updated in the caption of the form upon which the calendar resides. This can be used in conjunction with the Caption property, although I cannot imagine why you would need both of them. 4. New Method ============= AddSpecialDay -- Use this method to create special days. It accepts three parameters: 1. A TDateTime variable representing the desired date ; 2. A string containing the name of the .ICO or .BMP file to display for that date. 3. A string containing additional descriptive information about that date. If used, this will be available to the user in the form of the calendar's Hint property. 5. New Event ============ OnChangeMonth -- this is called whenever the user crosses a month boundary navigating within the calendar. This hook is provided in case the Caption or UseFormCaption properties are not sufficient for your particular situation. 6. Copyright Notice =================== This component is fully functional. My copyright notice will appear when you drop it upon a form at design-time, but that will not occur at run-time. 7. Disclaimer ============= It is unfortunate that we live in a litigous society in which the lawyers are generally the only winners. However, that makes the following verbiage necessary: "THE CODE FOR THIS COMPONENT IS PROVIDED TO YOU AS IS BY ITS AUTHOR, GREG LIEF. THE AUTHOR HAS TESTED THE COMPONENT AND FEELS THAT IT WORKS AS BILLED, BUT MAKES ABSOLUTELY NO GUARANTEES OR WARRANTEES OF ANY KIND. IN OTHER WORDS, YOU ARE USING THIS ENTIRELY AT YOUR OWN RISK. NEITHER THE AUTHOR NOR ANY OTHER ORGANIZATION WILL BE HELD RESPONSIBLE FOR ANY DIRECT OR INDIRECT DAMAGE RESULTING FROM THE USE OF EITHER THIS COMPONENT OR ANY DERIVATIVES THEREOF." 8. Technical Support ==================== The reason I am making this component available as freeware because I feel that it will be of use to other Delphi developers. However, always remember the old maxim "you get what you pay for". In other words, do not get carried away by expecting technical support, because you will be sadly disappointed. 9. Revision History =================== Dec 20, 1996 -- added Menu property (thanks Keith!) Dec 19, 1996 -- substituted SelectedColor property with SelectedBGColor and SelectedFGColor properties for greater control Dec 07, 1996 -- added "System Date" option to integrated popup menu Dec 06, 1996 -- added support for Home and End keys to jump to first and last days of current month Nov 06, 1996 -- a) added pop-up menu to move by month/year and show description for special days b) attached label was not being redisplayed if CalendarDate property was changed programmatically. Fixed. Sep 12, 1996 -- removed logic which shrunk the column headings Sep 09, 1996 -- initial public release 10. Comments ============ If you find this component useful, I would appreciate hearing from you via e-mail (greglief@teleport.com). I would also greatly appreciate your taking the time to evaluate the Delphi Object Lessons technical journal, for which I serve as Executive Editor. More information and a sample issue are available at URL http://www.teleport.com/~ol/djournal.shtml. If you would like to learn how to create your own components, you should strongly consider the Delphi Training Tour component creation seminar, designed by yours truly. For more information, visit URL http://www.teleport.com/~ol/dtt.shtml. The most updated version of this component can always be found at my personal web site (http://www.teleport.com/~greglief). *** over and out ***