Page 1 of 1

Bug: RectangleTool, Annotation Tool tests

Posted: Thu May 13, 2010 5:45 am
by 13051032
A TypeOf test on a set of chart tools wrongly passes the RectangleTool as Annotation tool. In the following piece of code, if you have an annotation tool and a rectangle tool added to a chart, when you loop over the tools to get their type, you always get AnnotationTool result. The only work around is to first test for rectangletool and then test for annotation tools.

This bug ate my whole afternoon :( I have latest Tchart V3 version.

Code: Select all

If TypeOf activeChart.Tools(toolIndex) Is Steema.TeeChart.Tools.Annotation Then
msgbox "Annotation Tool"
ElseIf TypeOf activeChart.Tools(toolIndex) Is Steema.TeeChart.Tools.RectangleToolThen
msgbox "RectangleTool"
endif

Re: Bug: RectangleTool, Annotation Tool tests

Posted: Thu May 13, 2010 7:27 am
by 15656109
Hi asupriya!

It's not a bug. The problem for you is that RectangleTool class is inherited from Annotation class. Instead of "is" operator you can check class type name, in C# it will be:

if ((typeof)activeChart.Tools(toolIndex)).Name == "RectangleTool"