When I create an array of TAnnotationTools by code they do never display.
AnnotationTools created in the editor works as expected.
What am I doing wrong ?
MAXBARSPERSCREEN = 64;
MMBez : Array[0..MAXBARSPERSCREEN-1] of TAnnotationTool;
for i := 0 to globdat.vBarConf.nBalken - 1 do begin
MMBez := TAnnotationTool.Create( Chart1 );
MMBez.Text := Format( '%d', );
MMBez.Top := 30;
MMbez.Left := i * 50;
MMBez.Height := 10;
MMBez.Width := 40;
MMBez.Active := true;
MMBez.Visible := true;
end;
creating AnnotationTool by code
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi mtspp,
This is because the tools are not properly added to the chart. You can do this:
or this:
This is because the tools are not properly added to the chart. You can do this:
Code: Select all
uses TeeTools;
procedure TForm1.FormCreate(Sender: TObject);
const
MAXBARSPERSCREEN = 64;
var
MMBez : Array[0..MAXBARSPERSCREEN-1] of TTeeCustomTool;
i: Integer;
begin
for i := 0 to Length(MMBez)-1 do begin
MMBez[i] := Chart1.Tools.Add(TAnnotationTool.Create( self ));
with (MMBez[i] as TAnnotationTool) do begin
Text := Format( '%d', [i] );
Top := 30;
Left := i * 50;
Height := 10;
Width := 40;
Active := true;
Visible := true;
end;
end;
end;
or this:
Code: Select all
uses TeeTools;
procedure TForm1.FormCreate(Sender: TObject);
const
MAXBARSPERSCREEN = 64;
var
MMBez : Array[0..MAXBARSPERSCREEN-1] of TAnnotationTool;
i: Integer;
begin
for i := 0 to Length(MMBez)-1 do begin
MMBez[i] := TAnnotationTool.Create( self );
with MMBez[i] do begin
Text := Format( '%d', [i] );
Top := 30;
Left := i * 50;
Height := 10;
Width := 40;
Active := true;
Visible := true;
end;
Chart1.Tools.Add(MMBez[i]);
end;
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |