Bug: RectangleTool, Annotation Tool tests

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
asupriya
Advanced
Posts: 179
Joined: Mon Dec 01, 2008 12:00 am

Bug: RectangleTool, Annotation Tool tests

Post by asupriya » Thu May 13, 2010 5:45 am

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

neurosoft
Newbie
Newbie
Posts: 35
Joined: Thu May 06, 2010 12:00 am

Re: Bug: RectangleTool, Annotation Tool tests

Post by neurosoft » Thu May 13, 2010 7:27 am

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"

Post Reply