How to add an allocation when the user right-clicks on the chart.
Use something like this.
procedure TForm1.RACRightClick(Sender: TObject); var resource: TssResource; slot: TssResourceAllocation; pt: TPoint; StartAt, EndAt: TDateTime; begin // 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) end; end;
Copyright © 2000-2010 Simon Armstrong. All Rights Reserved.


