Legend with Scrollbar - Error

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Matt Venkat
Newbie
Newbie
Posts: 16
Joined: Wed May 18, 2005 4:00 am
Location: Sydney, Australia
Contact:

Legend with Scrollbar - Error

Post by Matt Venkat » Thu Apr 19, 2012 2:52 am

Hi,

I use FastLine graph and display Legend with checkbox on the graph. Series will be added dynamically.

When there are multiple series, The legend will show the a few series ( with Vertical scroll bar. When you click down arrow to scroll down, I got the following error. "List index out of bounds (10)". Even when I hit "OK" button to close the msg box, it appears again and again. Then the program couldn't run properly.

Environment: Delphi 2010
Current TeeChart version: V2012 pro
Previous TeeChart Version: version 8 pro

Image

The program was implemented in TeeChart Pro version 8 and now it is upgraded to version 2012. It happens both version 8 and v2012.

Can anyone please help me out to solve this error?

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

Re: Legend with Scrollbar - Error

Post by Narcís » Thu Apr 19, 2012 10:14 am

Hi Matt,

I'm not able to reproduce the issue here using v2012.05.120327 and the code snippet below. Can you please modify it so that we can reproduce the problem here?

Code: Select all

uses Series, TeeLegendScrollBar;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  for i:=0 to 50 do
    Chart1.AddSeries(TFastLineSeries.Create(Self)).FillSampleValues;

  Chart1.Tools.Add(TLegendScrollBar.Create(Self));
  Chart1.View3D:=False;
end;
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

Matt Venkat
Newbie
Newbie
Posts: 16
Joined: Wed May 18, 2005 4:00 am
Location: Sydney, Australia
Contact:

Re: Legend with Scrollbar - Error

Post by Matt Venkat » Thu May 03, 2012 5:23 am

Hi Narcis,

Last days, I was trying to regenrate the error from your sample program but I couldn't able to do it.

But yesterday, I found out the cause of the problem. The cause is there are extra hidden series. For instance, I have 8 series added to the chart. But there is something worng in the program or the library, the total series count as 10. So, Scrollbar thinks there are 10 series. That's why when i hit down arrow key to go down and i get "List index out of bunds" error when i hit 9th series. Beause there is no 9th or 10th series in the graph.


Do you have any guides to fix the problem?
Can we have Up arrow or Down arrow Key event from Scrollbar and how?

Thanks in advance.

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Legend with Scrollbar - Error

Post by Yeray » Thu May 03, 2012 3:32 pm

Hi Matt,
Matt Venkat wrote:Last days, I was trying to regenrate the error from your sample program but I couldn't able to do it.

But yesterday, I found out the cause of the problem. The cause is there are extra hidden series. For instance, I have 8 series added to the chart. But there is something worng in the program or the library, the total series count as 10. So, Scrollbar thinks there are 10 series. That's why when i hit down arrow key to go down and i get "List index out of bunds" error when i hit 9th series. Beause there is no 9th or 10th series in the graph.

Do you have any guides to fix the problem?
It has to be something in your application that is creating this series. Could you please try to arrange a simple example project we can run as is to reproduce the problem here?
Thanks in advance.
Matt Venkat wrote:Can we have Up arrow or Down arrow Key event from Scrollbar and how?
You can use the chart's OnKeyDown event to check if the TeeKey_Down/TeeKey_Up keys have been pressed. And you could combine it with the OnMouseMove event if you want to check the keys only when the mouse is in the Legend area. For example:

Code: Select all

var MouseInLegend: Boolean;

procedure TForm1.FormCreate(Sender: TObject);
begin
  MouseInLegend:=false;
end;

procedure TForm1.Chart1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if MouseInLegend then
  case Key of
    TeeKey_Down: Caption:='Down!';
    TeeKey_Up: Caption:='Up!';
  end;
end;

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  MouseInLegend:=(Chart1.Legend.Clicked(X,Y)>-1);
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply