Page 1 of 1

TColorBandTool and OnDragLine event problem

Posted: Tue Nov 15, 2011 4:59 pm
by 10554269
Hello. I have TeeChart 8.08. I have a cahrt with a TColorBandTool. I have assigned OnDragLine events to StartLine and EndLine of TColorBandTool. If I assign these events, then the colorBand is not repainted while dragging. If I remove the events, everything works again. this is mi code:

Code: Select all

           TColorBandTool* band = new TColorBandTool(...);
            band->Axis  = Chart1->BottomAxis; 
            band->OnClick = BandaSelecClick;
            band->OnResized = rectResized;
            band->StartLine->OnDragLine =  SelectDrag;     /******** If you remove this line then everything works   ***********/
            band->StartLine->Active = true;
            band->StartLine->AllowDrag = true; 
            ...
Am I doing something wrong?

Re: TColorBandTool and OnDragLine event problem

Posted: Thu Nov 17, 2011 11:36 am
by yeray
Hello,

I could reproduce the problem here. It seems that the StartValue of the TColorBandTool isn't updated when its StartLine TColorLineTool has the OnDragLine event assigned. However, it can be simply achieved assigning it yourself in that event:

Code: Select all

procedure TForm1.SelectDrag(Sender:TColorLineTool);
begin
  with Chart1.Tools[0] as TColorBandTool do
    if Sender = StartLine then
      StartValue:=Sender.Value;
end;
This is Delphi code but should be the same in C++Builder.
In the example above I assume the first tool is the TColorBandTool. If you don't know where it is, you will have to loop into the chart tools to find it.

Re: TColorBandTool and OnDragLine event problem

Posted: Thu Nov 17, 2011 4:40 pm
by 10554269
I thought this could be happening. I've done what you've said. In order to avoid loop into the tools, I have assigned ColorBand pointer to the Tag property of the StartLine and EndLine.

Best Regards.