TPlanner : Frequently asked questions

Q: When I try to install the package, it asks for Planner.pas

A: Make sure the correct version of PLANNER.DCU is in your library path, that your library path contains the directory where PLANNER.DCU is installed and that no other versions of PLANNER.DCU are in your library path.

Q: How can I scroll programmatically in the planner ?

A: Control scroll with the properties Planner.GridTopRow and Planner.GridLeftCol

Q: How do I get a horizontal planner ?

A: Set Planner.SideBar.Position to spTop

Q: When I run my application I get an error "property does not exist"

A: An older version of PLANNER.DCU might be in your library path.

TPlanner : Tips

For maintaining custom data with each planner item you can assign any TObject descendent class to the PlannerItem's public Object property. Now there is a more convenient way to create a descendent class from TPlanner that has a TPlannerItem with new custom properties which can be used at design time and at run time to hold any additional values with each planner item. The code involved comes down to :

  • Write your descendent class of TPlannerItem and add the additional properties
  • Write your descendent class of the TPlannerItems collection and override the GetItemClass method to instruct the collection to create collection items from your descendent TPlannerItem class.
  • Write your descendent class of TPlanner and override the protected CreateItems method to let the planner use your descendent TPlannerItems collection.
Following code where a new property MyProperty was added to the TPlannerItem, makes this clear :

unit MyPlanner;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Planner;

type
  TMyPlannerItem = class(TPlannerItem)
  private
    FMyProperty: string;
  published
    property MyProperty: string read FMyProperty write FMyProperty;
  end;

  TMyPlannerItems = class(TPlannerItems)
  public
    function GetItemClass: TCollectionItemClass; override;
  end;

  TMyPlanner = class(TPlanner)
  private
    { Private declarations }
  protected
    { Protected declarations }
    function CreateItems: TPlannerItems; override;
  public
    { Public declarations }
  published
    { Published declarations }
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('TMS', [TMyPlanner]);
end;

{ TMyPlannerItems }

function TMyPlannerItems.GetItemClass: TCollectionItemClass;
begin
   Result := TMyPlannerItem;
end;

{ TMyPlanner }

function TMyPlanner.CreateItems: TPlannerItems;
begin
  Result := TMyPlannerItems.Create(Self);
end;

end.