How do I delete lines from TDrawLineTool

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Fang
Newbie
Newbie
Posts: 66
Joined: Wed Oct 13, 2004 4:00 am

How do I delete lines from TDrawLineTool

Post by Fang » Sun Apr 30, 2006 10:30 pm

hi,
searched the forum, found this http://www.teechart.net/support/viewtopic.php?t=3552 .

So very happy to try TDrawLine->Destroy(), but the error is that DrawLine doesn't have Destroy() method.

How do I delete lines then.

Fang

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue May 02, 2006 7:45 am

Hi Fang,

Please read the topic you pointed carefully. You need to use:

Code: Select all

ChartTool1->Lines[0]->Destroy();
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Fang
Newbie
Newbie
Posts: 66
Joined: Wed Oct 13, 2004 4:00 am

Post by Fang » Fri May 05, 2006 1:46 pm

for whatever reason, it just doesn't work.

Code: Select all

  TDrawLine* dl=(TDrawLine*)DrawLineTool->Lines->Items[0];
  dl->Destroy();
  
or 

  (*DrawLineTool->Lines)[0]->Destroy();
it says Destroy is not a member of TDrawLine. HELP

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri May 05, 2006 1:57 pm

Hi Fang,

Try using something like this:

Code: Select all

void __fastcall TForm1::Button1Click(TObject *Sender)
{
        for (int i=0; i<ChartTool1->Lines->Count;i++)
        {
                ChartTool1->Lines->Delete(i);
        }
        Chart1->Refresh();
}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Fang
Newbie
Newbie
Posts: 66
Joined: Wed Oct 13, 2004 4:00 am

Post by Fang » Fri May 05, 2006 3:20 pm

First of all, the above code probably should write like this

Code: Select all

  while (DrawLineTool->Lines->Count>0) {
	DrawLineTool->Lines->Delete(0);
  }
But anyway, I tried both, none of them works (No error either).

Fang
Newbie
Newbie
Posts: 66
Joined: Wed Oct 13, 2004 4:00 am

Post by Fang » Mon May 08, 2006 1:53 pm

can't u guys just try using the above lines in v7.06 or .07? and just please comfirm if the solution you gave me works.

bds2006 c++ builder v7.06 (or .7)
i don't think they works in c++ builder 6 either.

:(

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed May 10, 2006 11:57 am

Hi Fang,

I've just tried with the following code and works fine (BDS2006 and TC7.07) :

Code: Select all

void __fastcall TForm1::Button1Click(TObject *Sender)
{
while (ChartTool1->Lines->Count >0) {
   ChartTool1->Lines->Delete(0);
}
ChartTool1->Repaint();

ShowMessage(IntToStr(ChartTool1->Lines->Count));
}
Could you please check if it works fine for you ? If you still having problems let me know and I'll send to you a simple app. to verify.

Post Reply