Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TPlanner
Programmatically setting header captions/group captions/custom groups

This planner header shows normal header captions and group captions

Programmatically, this can be set by filling the Planner.Header.Captions and Planner.Header.GroupCaptions stringlists in following way:

with Planner1.Header do 
begin 
  Captions.Clear; GroupCaptions.Clear; 
  Captions.Add(''); // take first sidebar header section into account 
  Captions.Add('A1'); 
  Captions.Add('A2'); 
  Captions.Add('A3'); 
  GroupCaptions.Add('Group A'); 
  Captions.Add('B1'); 
  Captions.Add('B2'); 
  Captions.Add('B3'); 
  GroupCaptions.Add('Group B'); 
end;
Note: At design time it is easy to enter multiline header captions by using „\n‟ as line separator. Setting at design time in the Captions stringlist editor : „This is line 1\n and here line2‟ will result in a caption with:

This is line1
and here line 2

In the example above, the header group size is equal for all groups and is set by the property Planner.PositionGroups. In order to show different group sizes for different columns, the Planner.Header.CustomGroups can be used. To use custom position groups, set Planner.PositionGroups to 1. The code snippet below produces a header with 3 groups with respectively a span of 2 positions, span of 3 positions and span of 1 position:

var 
  i: Integer; 
begin 
  with planner1.Header do
  begin 
    CustomGroups.Clear; 
    with CustomGroups.Add do 
    begin 
      Caption := 'Group 1'; 
      Span := 2; 
    end; 
    with CustomGroups.Add do 
    begin 
      Caption := 'Group 2'; 
      Span := 3; 
    end; 
    with CustomGroups.Add do 
    begin 
      Caption := 'Group 3'; 
      Span := 1; 
    end;

    Captions.Clear; 
    Captions.Add(''); 
    for i := 1 to 6 do 
      Captions.Add('Col '+inttostr(i)); 
    end; 
end;