Page 1 of 1

How do I delete lines from TDrawLineTool

Posted: Sun Apr 30, 2006 10:30 pm
by 9234539
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

Posted: Tue May 02, 2006 7:45 am
by narcis
Hi Fang,

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

Code: Select all

ChartTool1->Lines[0]->Destroy();

Posted: Fri May 05, 2006 1:46 pm
by 9234539
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

Posted: Fri May 05, 2006 1:57 pm
by narcis
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();
}

Posted: Fri May 05, 2006 3:20 pm
by 9234539
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).

Posted: Mon May 08, 2006 1:53 pm
by 9234539
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.

:(

Posted: Wed May 10, 2006 11:57 am
by Pep
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.