When creating a bar in a Gantt diagram with e.g. AddGanttColor, the function returns a index value as, according to the help file, can be used to address the bar.
When I create multiple bars on each line, the returned index value is re-used sometimes (have not figured out the pattern) and is therefore not useable for identifying each individual bar. Why is that? Have I misunderstood the concept of the returned index value?
What I need is to be able to identify what individual bar is being clicked. Is there a way of accomplishing this by other means than the above mentioned index value?
Thanks!
Jon
Addressing individual Gantt bars
Hi Jon,
Maybe what you're trying to accomplish is similar to the Gantt Drag Tool ? Have you seen it ? You can find one example in the Demo Features project.
Yes, you could use the OnClick event of the Gantt Series, which returns the ValueIndex of the gantt clicked, or you can use the Clicked method :What I need is to be able to identify what individual bar is being clicked. Is there a way of accomplishing this by other means than the above mentioned index value?
Code: Select all
procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var clickedIndex : integer;
begin
ClickedIndex := Series1.Clicked(x,y);
ShowMessage(inttostr(ClickedIndex));
abort;
end;
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi Pep,
Thanks for the reply.
Meanwhile, I found this explanation (through Google Groups search) to the strange index numbers:
>David Berneda 23 Mar 1998 10:00 wrote:
>
>By default, Gantt series sort points by X values.
>Disabling X sorting ( or calling AddGantt with X values sorted ) will >maintain the index numbers.
>
>Series1.XValues.Order := loNone ;
>Series1.AddGantt...
>Series1.AddGantt...
>
>In your code, the second gantt bar has a lower X value than the
>first. So that's why the index is zero in the two cases.
This worked for me and gave me some relief this afternoon.
Thanks again!
Jon
Thanks for the reply.
Meanwhile, I found this explanation (through Google Groups search) to the strange index numbers:
>David Berneda 23 Mar 1998 10:00 wrote:
>
>By default, Gantt series sort points by X values.
>Disabling X sorting ( or calling AddGantt with X values sorted ) will >maintain the index numbers.
>
>Series1.XValues.Order := loNone ;
>Series1.AddGantt...
>Series1.AddGantt...
>
>In your code, the second gantt bar has a lower X value than the
>first. So that's why the index is zero in the two cases.
This worked for me and gave me some relief this afternoon.
Thanks again!
Jon