Tuesday, September 27, 2011
2. Toolbar buttons
3. Database tables
The WBS project example demonstrates how to use ActiveGantt in
project management applications with a Work Breakdown Structure (WBS). This example, the complete source code and database tables are provided free of charge with the demo for the ActiveGantt component in a variety of programming languages.
The control receives and updates the bulk of it's data to and from the
table tb_GuysStThomas in the ActiveGanttExamples.mdb
Microsoft Access 2003 database. An additional table
tb_GuysStThomas_Predecessors stores information about task
Only for the purpose of this example the tb_GuysStThomas table stores
tasks and rows on a same record in the database, therefore one row can
only have one task and one percentage object associated with the task.
On the other hand, in this example, a task can have none or several
predecessor objects because they are stored in the
tb_GuysStThomas_Predecessors table that has a one-to-many relationship
On the left hand side of the control the treeview object is visible. The
nodes in the treeview can be collapsed or expanded to hide or show
the complete Work Breakdown Structure (WBS) for the task.
Each node can have it's own independent image, check boxes and font.
Nodes also provide a way to calculate totals and sub-totals. Summary
tasks are updated whenever a child task is moved or sized. Also in this
example once a percentage object is resized the parent summary tasks are
updated as well, calculating the average percentage complete of all of
their child nodes. Summary tasks cannot be moved.
Percentages can be resized by selecting them and dragging the right hand
Tooltips for this example are custom drawn, and include the image that
is associated with the node object in question.
Predecessors can be added between tasks by pressing and holding the
ALT key while over the selected task object. The
selected task then becomes the predecessor task. By dragging the cursor
over to another task and releasing the mouse button a predecessor object
There are four types of predecessor objects: End-To-Start,
Start-To-Start, End-To-End and
Start-To-End. The nature of the predecessor type is determined
by the position within the task where the mouse button is pressed and
released. In the above example the mouse has been pressed near the end
of the predecessor task and will surely be released near the start of
the task. This will create an End-To-Start relationship. The predecessor
object will be stored in the "Pathology: Haematology Day Care" task
predecessors collection. The nature of the relationship can also be
restricted programatically in the ObjectAdded event. For the purpose of this example predecessors
are not restricted in any way.
Right clicking on any task object will bring up the predecessor information
Summary tasks are restricted in such a way that they cannot accept
incoming or outgoing predecessor requests.
2. Toolbar buttons:
Pressing the print button will bring up the fPrintDialog form
where you will be able to preview and print the chart. fPrintDialog,
fPrintPreview and fSchedulePrintSettings include code that can be reused
in your application to implement printing for the ActiveGantt component.
The magnifier buttons enable you to zoom in and zoom out of the chart.
The toggle percentages buttons allow you to show or hide the percentages
of the task objects using layers. The blue is for regular task objects,
green for green summaries, and red for red summaries.
The tooltip button shows or hides tooltips.
Pressing the help button will bring up this help topic.
3. Database tables:
The Gantt chart uses two tables: tb_GuysStThomas and tb_GuysStThomas_Predecessors.
tb_GuysStThomas is the main table for the Gantt chart, it contains information about the tasks, the Work Breakdown Structure (WBS), and percent complete. It has the following fields:
ID: An automatically generated long integer (with increments of 1) used as the primary key for the Task object.
Depth: This field specifies the indentation of the Task object on the Treeview, it defines the hierarchy for the Work Breakdown Structure (WBS). A depth of 0 means that the Task object is at the top of the hierarchy, as is not a sub-task of any other Task object. The higher this number is the lower level of subordination this Task object has.
TaskType: An alpha numeric value which can be either "A" or "F". In conjunction with the Depth field determines the image or icon to be displayed in the Treeview and in the tooltips for the Task object. A value of "F" and a Depth of 0 will display the folder icon (Expanded or Collapsed). For any other Depth value (greater than 0) it will display the three cubes icon. A value of "A" will display the task icon.
Description: An alpha numeric value that specifies the caption for the Task object.
StartDate: The Task's start date.
EndDate: The Task's end date.
PercentCompleted: A floating point number that determines the percent complete for a Task. 1 = 100%, 0 = 0%. In the Gantt chart values are rounded to the two most significant digits.
Summary: Specifies whether the Task is broken down into sub-tasks, and should be handled as a summary Task within the Gantt chart. If the Task is marked as a summary it cannot be resized, it will be resized if any of the subordinate tasks are resized.
HasTasks: Specifies whether the Task has subordinate tasks.
Note: If the StartDate is equal to the EndDate, the Task becomes a Milestone. Task objects in the Gantt chart are actually a combination of two objects: Rows and Tasks.
This is a screen shot of some sample data from tb_GuysStThomas:
The Jet SQL DDL creation statements for this table are the following:
CREATE TABLE [tb_GuysStThomas] (
[TaskType] TEXT(255) WITH COMPRESSION,
[Description] TEXT(255) WITH COMPRESSION,
[PercentCompleted] SINGLE DEFAULT 0,
[Summary] BIT NOT NULL,
[HasTasks] BIT NOT NULL,
CONSTRAINT [PrimaryKey] PRIMARY KEY ([ID])
ALTER TABLE [tb_GuysStThomas] ALLOW ZERO LENGTH [TaskType];
ALTER TABLE [tb_GuysStThomas] ALLOW ZERO LENGTH [Description];
tb_GuysStThomas_Predecessors stores information about the predecessor relationships between tasks in the Gantt chart. It has the following fields:
ID: An arbitrary long integer generated automatically by the database used as the primary key.
PredecessorID: A foreign reference to the ID field of the tb_GuysStThomas table for the Task that will be the predecessor task.
TaskID: A foreign reference to the ID field of the tb_GuysStThomas table for the Task that will be the main task.
Type: The type of the predecessor relationship: 0 = From the EndDate of the Predecessor to the StartDate of the Task (End-To-Start), 1 = From the StartDate of the Predecessor to the StartDate of the Task (Start-To-Start), 2 = From the EndDate of the Predecessor to the EndDate of the Task (End-To-End) and 3 = From the StartDate of the Predecessor to the EndDate of the Task (Start-To-End).
This is a screen shot of some sample data from tb_GuysStThomas_Predecessors:
The Jet SQL DDL creation statement for this table is the following:
CREATE TABLE [tb_GuysStThomas_Predecessors] (
[PredecessorID] LONG DEFAULT 0,
[TaskID] LONG DEFAULT 0,
[Type] LONG DEFAULT 0,
CONSTRAINT [PrimaryKey] PRIMARY KEY ([ID])