TYearPlanner ReadMe
By Jonathan Hosking
V2.21 (18/11/2000)

Table of contents

What is the TYearPlanner component?
How to install the TYearPlanner component
TYearPlanner reference
Revision history
Future ideas
Other components
Contacting me

What is the TYearPlanner component?

The TYearPlanner component is a new component I have written for Delphi and C++Builder. It simply looks like a year planner. It can be fully customised if desired. It has the following features: -

The component code was written by modifying some code for my TOffice97Button component. The routine that tests for leap years is the routine used in Delphi 5.0. The code works fine on Delphi 1.0, 2.0, 4.0, 5.0 and C++Builder 3.0 & 4.0, but I have not tested it with other versions.

You are free to distribute the code, but you may NOT sell it. If you modify the code, you must include me in the acknowledgements. If you do want your ideas or modifications to be incorporated into the latest version, send them to the address at the end of this document.

Thanks to Simon Nicholson for helping with the message hook to reduce flickering.

Thanks to Richard Haven for helping with the heading setup routine.

Thanks to Wolfgang Kleinrath for helping with the data setup routine and providing the code for the original routines for loading and saving cell data to INI files

Thanks to Nacho Urenda for helping with the size calculation routine.

Thanks to Rob Schoenaker for helping with the drawing routine.

Thanks to Robert Gesswein for adding the NoDayPriority and StartDayOfWeek properties, and for helping with the SetColorAtDate routine.

Thanks to Paul Fisher for adding printing support, the original routines for loading and saving cell data to streams, and for helping out with the new cell selection routines.

Thanks to Paolo Prandini for removing the range check errors in the component routines.

Thanks to Max Evans for the navigation buttons and graphical customisation improvements.

Thanks to Goldschmidt Jean-Jacques for the selection information routines.

Thanks to Roberto Chieregato for the cell images routines.

Thanks to Martin Roberts for fixing a bug with cell selections.

Thanks to Kaj Ekman for the code to draw images without stretching.

Thanks to David Oakes for the code to control the display of default hints.

How to install the TYearPlanner component

To unzip the TYearPlanner component, assuming [Program Path] is the path to Delphi or C++Builder, follow these steps: -

  1. Unzip the file YEARPLAN.ZIP to any directory, using the directory switch (This is VERY important).
  2. Copy the file YEARPLAN.PAS to the directory [Program Path]\Source\Samples.
  3. If you want documentation, copy the file YEARPLAN.HTM to the directory [Program Path]\Bin, if you are using Delphi 1.0. Otherwise, copy it to the directory [Program Path]\Help.
  4. If you are using Delphi 1.0, copy the files in the 16-Bit directory of this Zip to the directory [Program Path]\Source\Samples. Otherwise, copy the files in the 32-Bit directory of this Zip to the directory [Program Path]\Source\Samples.

You can now install the component into the component library. Follow the procedure for the version of Delphi or C++Builder that you are using.

Delphi 1.0:

  1. Click on Options and then select Install Components.
  2. In the Install Components dialog, click Add. In the next dialog, click Browse and open the file YEARPLAN.PAS.
  3. Click Ok to install the component.

Delphi 2.0:

This procedure should also work with C++Builder 1.0, but I'm not sure.

  1. Click on Component and select Install.
  2. In the Install Components dialog, click Add. In the next dialog, click Browse and open the file YEARPLAN.PAS.
  3. Click Ok to install the component.

Delphi 4.0:

  1. Click on Tools and select Environment Options.
  2. In the next dialog, click on the Library tab and add the full path of the TYearPlanner source code to the Library Path edit box. Then click Ok.
  3. Click on Component and select Install Component.
  4. In the Install Component dialog, click on the Into existing package tab. Click on the first Browse button and open the file YEARPLAN.PAS. Then click on the second Browse button and open the file DCLUSR40.DPK. Finally, click Ok to install the component.

Delphi 5.0:

  1. Click on Tools and select Environment Options.
  2. In the next dialog, click on the Library tab and add the full path of the TYearPlanner source code to the Library Path edit box. Then click Ok.
  3. Click on Component and select Install Component.
  4. In the Install Component dialog, click on the Into existing package tab. Click on the first Browse button and open the file YEARPLAN.PAS. Then click on the second Browse button and open the file DCLUSR50.DPK. Finally, click Ok to install the component.

C++Builder 3.0:

This procedure should also work, with minor modifications, with Delphi 3.0, but I'm not sure.

  1. Click on Tools and select Environment Options.
  2. In the next dialog, click on the Library tab and add the full path of the TYearPlanner source code to the Library Path edit box. Then click Ok.
  3. Click on Component and select Install Component.
  4. In the Install Component dialog, click on the Into existing package tab. Click on the first Browse button and open the file YEARPLAN.PAS. Then click on the second Browse button and open the file DCLUSR35.BPK. Finally, click Ok to install the component.

C++Builder 4.0:

This procedure should also work, with minor modifications, with C++Builder 5.0, but I'm not sure.

  1. Click on Tools and select Environment Options.
  2. In the next dialog, click on the Library tab and add the full path of the TYearPlanner source code to the Library Path edit box. Then click Ok.
  3. Click on Component and select Install Component.
  4. In the Install Component dialog, click on the Into existing package tab. Click on the first Browse button and open the file YEARPLAN.PAS. Then click on the second Browse button and open the file DCLUSR40.BPK. Finally, click Ok to install the component.

TYearPlanner reference

Remarks:

Just in case you didn't know, here is how you get information about a cell. You get the day using Day := CurrentDate.Day and the month by using Month := CurrentDate.Month. The date details are then obtained with the following: -

To get the start and end dates in a selection, use the GetStartDate and GetEndDate routines. Both routines return a TDateTime as the value.

To see if a date is selected, use the IsCellSelected routine. You need to specify the date as a TDateTime, and the return value is a boolean.

You can select a cell manually using the SelectCells procedure, specifying two TDateTimes as the start date and end date.

The SetColorAtDate procedure can be used to set the cell colour of a date. You need to specify the date, as a TDateTime, the cell colour and whether or not the control should immediately show the change.

The SetHintAtDate procedure can be used to set the hint of a date. You need to specify the date, as a TDateTime, the hint and whether or not the control should immediately show the change.

The SetImageAtDate procedure can be used to set the cell image of a date. You need to specify the date, as a TDateTime, the cell image and whether or not the control should immediately show the change.

The GetCellData function is used to retrieve cell data for a date. You specify the date as a TDateTime, and it will return a TCellData with the cell data.

IMPORTANT: You must use the SetColorAtDate, SetHintAtDate, SetImageAtDate and GetCellData routines to read and set the CellData variable in C++Builder. Do not directly access the CellData variable.

You can use the LoadFromFile and SaveToFile procedures to load and save the cell data to a file.

You can use the LoadFromStream and SaveToStream procedures to load and save the cell data to a stream.

Known problems:

There is a problem with the control in C++Builder. Basically, due to some strange reason, you cannot directly access the CellData variable. To read the CellData variable, you must use the GetCellData function. To set the CellData variable, use the SetColorAtDate, SetHintAtDate and SetImageAtDate functions.

Key properties:

Key events:

Runtime properties:

Revision history

V2.21 (18/11/2000)

V2.2 (04/11/2000)

V2.13 (18/10/2000)

V2.12 (17/10/2000)

V2.11 (07/10/2000)

V2.1 (26/09/2000)

V2.01 (23/07/2000)

V2.0 (18/06/2000)

V1.9 (14/06/2000)

V1.8 (11/03/2000)

V1.75 (07/03/2000)

V1.74 (22/02/2000)

V1.73 (19/02/2000)

V1.72 (12/02/2000)

V1.71 (06/02/2000)

V1.7 (25/01/2000)

V1.63 (22/01/2000)

V1.62 (08/12/1999)

V1.61 (22/11/1999)

V1.6 (21/11/1999)

V1.57 (01/11/1999)

V1.56 (23/10/1999)

V1.55 (02/10/1999)

V1.54 (29/09/1999)

V1.53 (20/09/1999)

V1.52 (13/09/1999)

V1.51 (11/09/1999)

V1.5 (07/09/1999)

V1.4 (04/09/1999)

V1.3 (29/08/1999)

V1.2 (21/08/1999)

V1.12 (17/08/1999)

V1.11 (12/08/1999)

V1.1 (25/05/1999)

V1.0 (26/07/1998)

Future ideas

I currently only have no ideas for future versions of the TYearPlanner component.

Other components

Below is a list other components that I have written: -

Contacting me

I am currently on the Internet. If you have any bug reports, comments, ideas, modifications, etc. then you can Email me at the address given below. You can also go to my web site to find out the latest information on my components.

Email: jonathan@the-hoskings.freeserve.co.uk
WWW: http://www.the-hoskings.freeserve.co.uk/