I would like to be able to change the brush style of an individual Gantt in run time. My intention would be to permit the user to R click on the Gantt and to open a Pop-up menu where the change could be selected.
Right now I am accessing Gantt properties by passing the GanttBar value to my object and making changes and assigning them back to the Gantt. That is fine except that I can not know the Gantt Bar index unless I move the Gantt. I would really like to know the Gantt by simply clicking on it. Is this possible? How woudl I do this?
Thanks
setting the brush style on an individual Gantt
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Gainco,
This is pretty easy. You can use series' OnClick event like this:
This is pretty easy. You can use series' OnClick event like this:
Code: Select all
procedure TForm1.Series1Click(Sender: TChartSeries; ValueIndex: Integer;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
Chart1.Title.Text[0] := 'Series index: ' + IntToStr(ValueIndex);
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 |
Instructions - How to post in this forum |
Okay,
Now that I have a value that corresponds to the GanttBar, how do I get this back to the TGanttTool?
The only way I have of getting to the GanttTool is through it's sender.
Let's approach it this way.
I want to change the Brush for one Gantt when I doubl-click on it.
How do I do that?
Thanks,
Larry
Now that I have a value that corresponds to the GanttBar, how do I get this back to the TGanttTool?
The only way I have of getting to the GanttTool is through it's sender.
Let's approach it this way.
I want to change the Brush for one Gantt when I doubl-click on it.
How do I do that?
Thanks,
Larry
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Larry,
You should save the index in a global variable and use it later with the GanttBar. You could also obtain the index with TChart's OnMouseDown event like this:Now that I have a value that corresponds to the GanttBar, how do I get this back to the TGanttTool?
The only way I have of getting to the GanttTool is through it's sender.
Code: Select all
procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var Index: Integer;
begin
Index := Series1.Clicked(X,Y);
if Index <> -1 then
begin
//Assign Index to a global variable
end;
end;
Ok, you can do use OnDblClick event like this:Let's approach it this way.
I want to change the Brush for one Gantt when I doubl-click on it.
How do I do that?
Code: Select all
procedure TForm1.Series1DblClick(Sender: TChartSeries; ValueIndex: Integer;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
Sender.ValueColor[ValueIndex]:=clLime;
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 |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Gainco
I'm afraid it's not possible setting a different brush style for each gantt bar.
I'm afraid it's not possible setting a different brush style for each gantt bar.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |