TYearPlanner ReadMe
By Jonathan Hosking
V1.75 (07/03/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, 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 new 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.

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 and C++Builder 4.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.

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 SelectCell procedure, specifying a TDateTime as the date to select.

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.

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

Known Problems:

There are currently no known problems with the control.

Key Properties:

Key Events:

Runtime Properties:

Revision History

V1.75 (07/03/2000)

  • Added a new SelectCell procedure which allows the user to manually select a cell.

V1.74 (22/02/2000)

  • Added a new OnYearChange event procedure which occurs when the year changes.

V1.73 (19/02/2000)

  • Bug Fixed - When multiple TYearPlanners were used on a form, they were sharing the same hint windows and some other internal variables.

V1.72 (12/02/2000)

  • Added some selection information routines to the component. Thanks to Goldschmidt Jean-Jacques for providing the code.

V1.71 (06/02/2000)

  • Bug Fixed - The mouse procedures now respond properly. In previous versions, the mouse procedures weren't called sometimes.

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/