I'm adding 2 tools to my chart (CrossHair Cursor and Mark Tips) with the following code:
long nInt1 = m_SelectedChart->GetTools().Add(tcCursor);
long nInt2 = m_SelectedChart->GetTools().Add(tcMarksTip);
What is the long returned by the Add method? Is it the position in the list of Tools? Or is it the tooltype (tcCursor or tcMarksTip)
Later I delete these tools from the ToolsList on the chart. If I don't have any other tools present, I delete the first 2 tools in the ToolsList. But if I have other tools present, how do I know which position in the list to delete?
m_SelectedChart->GetTools().Delete(???) What is the index I use here?
Thanks.
CTools Add method
Hi nbp,
For example, the following works:
This method returns the index of the tool. The first will be the 0,...nbp wrote:What is the long returned by the Add method? Is it the position in the list of Tools? Or is it the tooltype (tcCursor or tcMarksTip)
You could save the index of each tool when created and use it to identify the tool to delete. And the indexes should persist.nbp wrote:Later I delete these tools from the ToolsList on the chart. If I don't have any other tools present, I delete the first 2 tools in the ToolsList. But if I have other tools present, how do I know which position in the list to delete?
For example, the following works:
Code: Select all
int cursorIndex = axTChart1.Tools.Add(TeeChart.EToolClass.tcCursor);
int colorLineIndex = axTChart1.Tools.Add(TeeChart.EToolClass.tcColorLine);
int annotationIndex = axTChart1.Tools.Add(TeeChart.EToolClass.tcAnnotate);
axTChart1.Tools.Delete(colorLineIndex);
axTChart1.Tools.Delete(cursorIndex);
axTChart1.Tools.get_Items(annotationIndex).asAnnotation.Text = "my text";
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |