A TGantt object is a control (inherits from TControl) which manages an array of items. Those items have coordinates and they get painted on the surface of the TGantt. Besides that, we can use the mouse to move those items and to redimension them. Thats all!
What we may want to do with those items is our matter (as programmers). Lets review a first example very easy to use TGantt so we understand it:
testgant.prg
- Code: Select all Expand view
- #include "FiveWin.ch"
#include "Gantt.ch"
function Main()
local oWnd, oGantt
DEFINE WINDOW oWnd TITLE "Class TGantt test"
@ 1, 1 GANTT oGantt SIZE 300, 300 OF oWnd
AAdd( oGantt:aItems, { 10, 10, 30, 80, CLR_BLUE } )
AAdd( oGantt:aItems, { 40, 30, 60, 110, CLR_RED } )
AAdd( oGantt:aItems, { 70, 50, 90, 90, CLR_GREEN } )
AAdd( oGantt:aItems, { 100, 10, 120, 80, CLR_CYAN } )
AAdd( oGantt:aItems, { 130, 50, 150, 120, CLR_YELLOW } )
oWnd:oClient = oGantt
ACTIVATE WINDOW oWnd
return nil
As you can see, we define 5 items for this Gantt, and we assign a color to each one. We could assign much more data, but for now, lets focus on the main idea. The result looks this way:
Moving and resizing the items:
You can download the EXE from here, so you can move and redimension the items with the mouse. Full source code included:
http://code.google.com/p/fivewin-contributions/downloads/detail?name=gantt.zop&can=2&q=