How to add an allocation when the user right-clicks on the chart.

Use something like this.

procedure TForm1.RACRightClick(Sender: TObject);
  resource: TssResource;
  slot: TssResourceAllocation;
  pt: TPoint;
  StartAt, EndAt: TDateTime;
  // convert the mouse position to local co-ordinates
  pt := RAC.ScreenToClient(Mouse.CursorPos);
  // find the nearest resource
  resource := RAC.FindResourceFromY(pt.y);
  if Assigned(resource) then begin
    // find the date/time equivalent to where the user clicked
    StartAt := RAC.XToDateTime(pt.x);
    // make the allocation 2 hours long by default,
    // centered on the click
    StartAt := StartAt - EncodeTime(1,0,0,0);
    EndAt := StartAt + EncodeTime(1,0,0,0);
    // if this slot is available then add a new allocation
    if resource.IsSlotFree(StartAt, EndAt) then
      slot := resource.AddSlot(StartAt, EndAt)
What People Say

Resource Allocation Chart is one of those rare components that really fires the imagination. It looks great and is extremely flexible. A must for any application that allocates time slots.
Trevor Pegley, Visionhall
More …

No malware No spam
McAfee Site Report
Web of Trust