Page 1 of 1

Legend scroll bar thumb not tracking with mouse

Posted: Mon Mar 30, 2009 4:22 pm
by 10049005
Hello, I'm having these issues with the Legend Scroll Bar thumb:

Legend scroll bar set up as DrawStyle = dsWhenNeeded
When user drags the Legend Scrollbar Thumb with the mouse, the thumb does not stay with the mouse cursor. This does elminate the dsWhenNeeded problem below.

Legend scroll bar set up as DrawStyle = dsAlways : Thumb can be dragged all the way to the right, where it gets "locked" or "stuck" and cannot be pulled back to the left with the mouse, or moved back with the left arrow. This still has the dsWhenNeeded problem above.

Delphi 2009, TeeChart Pro v8.04.11395 Win32 (XP)

object chrtTst: TChart
Left = 2
Top = 2
Width = 1057
Height = 473
Legend.Alignment = laTop
Legend.CheckBoxes = True
Legend.ColorWidth = 5
Legend.Symbol.Width = 5
Title.Text.Strings = (
'Test Legend')
View3D = False
Align = alClient
Color = clWhite
TabOrder = 0
OnMouseDown = chrtTstMouseDown
OnMouseUp = chrtTstMouseUp
ColorPaletteIndex = 13
object ctScrollBar: TLegendScrollBar
ArrowBrush.Color = 10671002
BackColor = 8095338
Brush.Color = clWhite
Brush.BackColor = 8095338
DrawStyle = dsWhenNeeded
Pen.Color = clWindowFrame
Size = 15
Thumb.Brush.Color = clSilver
Thumb.Brush.BackColor = clSilver
Thumb.Gradient.EndColor = 10790258
Thumb.Gradient.StartColor = 10790258
Thumb.Gradient.Visible = True
Thumb.Size = 17
ThumbBrush.Color = clSilver
ThumbBrush.BackColor = clSilver
ThumbSize = 17
end
end

Additionally at Runtime:
chrtTst.Legend.ColumnWidthAuto := False;
chrtTst.Legend.ColumnWidths[0] := GetWidestTitle; (my code - returns a reasonable number)
chrtTst.Legend.VertMargin := ctScrollBar.Size + 7; (when scroll bar is active)

How can I overcome problems with thumb/mouse positioning and also perhaps the thumb "locking", as described above? I am trying to keep the Legend position, and fixed column widths if possible.

Thanks..

Posted: Mon Mar 30, 2009 4:41 pm
by narcis
Hi DanKerlee,

Could you please send us a simple example project we can run "as-is" to reproduce the problem here?

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.

Example posted

Posted: Mon Mar 30, 2009 6:42 pm
by 10049005
Narcis, I posted an example although unfortunately this one only shows the first problem. However if I fix that one it will really help,

Thanks,
dan

Posted: Tue Mar 31, 2009 7:54 am
by narcis
Hi dan,

Thanks for the example project but I'm not able to run it here because it uses RzXxxx components which we don't have here. It also uses a database connection which couldn't be openned. Can you please arrange a simple example project we can run "as-is"?

Thanks in advance.

Posted: Tue Mar 31, 2009 2:39 pm
by 10049005
Narcis, I took out the Raise controls that I missed earlier, if there are still problems compling perhaps there is a uses reference that can be removed somewhere.. the database objects were not used but should have been removed and are gone now, sorry for the confusion. You should find ThumbTest2.zip uploaded now,

Thanks,
Dan

Posted: Thu Apr 02, 2009 10:01 am
by yeray
Hi Dan,

I think I could reproduce the problem here with a simpler code:

Code: Select all

uses series, TeeLegendScrollBar;

procedure TForm1.FormCreate(Sender: TObject);
var
  I: Integer;
begin
  for I := 0 to 80 do
  begin
    Chart1.AddSeries(TBarSeries.Create(nil));
    Chart1[i].FillSampleValues(1);
    Chart1[i].Title := 'bar series number ' + IntToStr(i);
  end;

  Chart1.Legend.CheckBoxes := true;
  Chart1.Legend.MaxNumRows := 12;
  Chart1.Legend.Alignment := laTop;

  Chart1.Tools.Add(TLegendScrollBar.Create(nil));
  (Chart1.Tools[0] as TLegendScrollBar).Thumb.Style := stsThumb1;
  (Chart1.Tools[0] as TLegendScrollBar).DrawStyle := dsAlways;  //dsWhenNeeded

  Chart1.Legend.ColumnWidthAuto := False;
  Chart1.Legend.ColumnWidths[0] := 120;
end;
It seems that the thumb doesn't go with the mouse with this "little thumbs".

In the other hand, I haven't been able to see the "locked" problem with dsAlways. Could you please try to modify the code above to see the thumb locked problem?

Thanks in advance

Posted: Thu Apr 02, 2009 7:09 pm
by 10049005
Thanks, Yeray,
I've posted another project that uses your code, (it frees the existing scroll bar and re-instantiates it, slightly different and possibly significant), ALSO, the lockup is slightly different than originally described as the thumb is simply moved to the right as far as possible, not over the control arrow. There are a few more notes inside the form as well. I've included the original form in this project also but the proj opens with the new form.
Thanks, Dan

Posted: Fri Apr 03, 2009 9:30 am
by yeray
Hi Dan,

I've seen in your application that you call SetScrollBars on AfterDraw event, and debugging, I've seen that pChart.Legend.Items.Count gives a wrong value when the bar is on its end and then it's deactivated.

I would recommend you not to call this method on AferDraw event if it's not necessary and maybe adjust your condition to activate/deactivate the tool.

Thanks for helping us in this testing process.

Posted: Fri Apr 03, 2009 2:58 pm
by 10049005
Yeray, not setting the margin (in SetScrollBars) seems to help with the locking issue, but that isn't the main point - the main one is the thumb not tracking with the mouse, as shown in the first post. Can we please find out more about that? Thanks, Dan

Posted: Fri Apr 03, 2009 3:14 pm
by yeray
Hi Dan,

Excuse me, when I reproduced the problem I forgot to mention that I added the bug to the wish list to be fixed asap (TF02014057).