Updating gantt bar with Stringgrid
Posted: Mon Nov 14, 2016 1:08 pm
Hello everyone,
i'm developping a simple project management app in C++ Builder 10 and i'm using the gantt chart for the task management.
I'm able to draw the gantt bar but i have a problem updating or rather deleting the old one for a new one. Let me explain further so it can be a little more clearer. I have a TStringgrid which contains a name of the task, the starting and the ending date of the task. The end user can create as much tasks as he/she wants, and i want essentially to update the bar each time the user click on a row, i.e. if the user clicks row 1 i want to display the gantt bar of task 1 with the starting and end date of the task 1, if it's row 5 which is selected it will be the gantt bar of task 5 with the starting and end date of the task 5. Each time the user clicks a new row the old one would be deleted and redrawed. To simplify this task i created a method which is called each time the user clicks a row. I tried it with Series.Clear() method but it don't get the result i want.
How can i realize this by modifying this drawgantt method? If you need more information don't hesitate ask and i will answer. I hope i'm clear because english is not my mothertongue.
Thank you very much
i'm developping a simple project management app in C++ Builder 10 and i'm using the gantt chart for the task management.
I'm able to draw the gantt bar but i have a problem updating or rather deleting the old one for a new one. Let me explain further so it can be a little more clearer. I have a TStringgrid which contains a name of the task, the starting and the ending date of the task. The end user can create as much tasks as he/she wants, and i want essentially to update the bar each time the user click on a row, i.e. if the user clicks row 1 i want to display the gantt bar of task 1 with the starting and end date of the task 1, if it's row 5 which is selected it will be the gantt bar of task 5 with the starting and end date of the task 5. Each time the user clicks a new row the old one would be deleted and redrawed. To simplify this task i created a method which is called each time the user clicks a row. I tried it with Series.Clear() method but it don't get the result i want.
Code: Select all
// This function is called each time the user clicks a row
void MainClass::drawgantt(TDate startdate,TDate enddate, int task, String nametask)
{
TGanttSeries *Series1;
Series1 = new TGanttSeries(this);
Series1->AddGantt(startdate, enddate, task,nametask);
Series1->ParentChart = Chart1;
}
Thank you very much