Page 1 of 1

Legend windowshades when scrlbar and legendscrlbar connected

Posted: Fri Aug 28, 2015 6:21 pm
by 16475083
Hi,

I have a scrollbar at the bottom of my chart and a legend scrollbar on the chart legend. I have them connected with the code:
ChartTool1.Position := ScrollBar1.Position; in the ScrollBarChange event
and
ScrollBar1.Position := ChartTool1.Position; in the ChartToolScrolled event.

If there are more entries on the legend than there are items per page, the legend starts to shrink in height (windowshades) as the bottom scrollbar nears it's maximum until finally the total items on the legend equals the number of items per page.

At this point, dragging the legend scrollbar produces strange results - if I click-hold the legend scrollbar and move the mouse up, the legend increases in height with the bottom of the legend moving down along with the legend scrollbar while the mouse moves further away from the scrollbar until I am moving the legend scrollbar with the mouse inches away from the scrollbar instead of the mouse tracking the center as it should be doing.

Is there a way to synchronize these two scrollbars without this error?

Thanks.

Re: Legend windowshades when scrlbar and legendscrlbar connected

Posted: Mon Aug 31, 2015 8:26 am
by yeray
Hello,

Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.

Re: Legend windowshades when scrlbar and legendscrlbar connected

Posted: Mon Aug 31, 2015 1:55 pm
by 16475083
Hi,

I enclose a simple example project to demonstrate this error.

Scroll the chart bottom scrollbar all the way to the right - observe what happens to the legend height after the legend scrollbar reaches it's bottom.

With the chart bottom scrollbar all the way to the right, click-hold the legend scrollbar and move the mouse up. This does not look right.

Is there a way to synchronize these two scrollbars without this error?

Is there any way to freeze the legend height to a specific height regardless of whether there are enough items in the legend to fill it?

Thanks.
.

Re: Legend windowshades when scrlbar and legendscrlbar connected

Posted: Mon Aug 31, 2015 3:45 pm
by 16475083
Hi,

I figured it out.

In the ScrollBarChange event, I changed:

ChartTool1.Position := ScrollBar1.Position;

to:

if (ScrollBar1.Position) < dbchart[0].count-((dbchart.Legend.LastValue - dbchart.Legend.FirstValue)) then
ChartTool1.Position := ScrollBar1.Position;

The problem was that I wasn't checking this and the legend scrollbar was being incremented after it had reached it's max.

I think this is a bug - but I have a workaround.

Thanks.
.