setting the brush style on an individual Gantt

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Gainco
Newbie
Newbie
Posts: 15
Joined: Tue Feb 21, 2006 12:00 am
Location: Gainesville, Ga

setting the brush style on an individual Gantt

Post by Gainco » Sat Oct 06, 2007 11:35 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Oct 08, 2007 9:11 am

Hi Gainco,

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
Image Image Image Image Image Image
Instructions - How to post in this forum

Gainco
Newbie
Newbie
Posts: 15
Joined: Tue Feb 21, 2006 12:00 am
Location: Gainesville, Ga

Post by Gainco » Mon Oct 08, 2007 3:37 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Oct 08, 2007 3:46 pm

Hi 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.
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:

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;
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?
Ok, you can do use OnDblClick event like this:

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
Image Image Image Image Image Image
Instructions - How to post in this forum

Gainco
Newbie
Newbie
Posts: 15
Joined: Tue Feb 21, 2006 12:00 am
Location: Gainesville, Ga

Post by Gainco » Mon Oct 08, 2007 4:13 pm

Yes, this works fine for color but can you show me how to change the Brush type?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Oct 09, 2007 8:15 am

Hi Gainco

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
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply