Type | Description | |||
Item as HITEM | A long expression that specifies the handle of the item where the PDM starts, or 0, if the Key indicates an unique key of the bar that starts scheduling the PDM. | |||
Key as Variant | A VARIANT expression that specifies the key of the bar where the PDM begins. If the Item parameter is 0, the chart looks for the first bar with specified key. |
Return | Description | |||
Long | A long expression that specifies if the operation was successfully (0), or any non-zero vaue, if the ScedulePDM method failed. |
The following screen show shows the chart before calling the SchedulePDM on the Oplata bar:
The following screen show shows the chart after calling the SchedulePDM on the Oplata bar:
Calling SchedulePDM method invokes the BarResize event for all affected bars.
In conclusion, if using the SchedulePDM method during a BarResize event, you can use a counter to prevent calling the SchedulePDM multiple times, like in the following sample VB:
Dim iSchedulePDM As Long Private Sub G2antt1_BarResize(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal Key As Variant) Debug.Print "BarResize invoked" If (iSchedulePDM = 0) Then iSchedulePDM = iSchedulePDM + 1 G2antt1.Items.SchedulePDM Item, Key iSchedulePDM = iSchedulePDM - 1 End If End SubThe following VB sample displays a message when the SchedulePDM starts and ends:
Private Sub G2antt1_ChartStartChanging(ByVal Operation As EXG2ANTTLibCtl.BarOperationEnum) If (Operation = exPDM) Then Debug.Print "SchedulePDM starts" End If End Sub Private Sub G2antt1_ChartEndChanging(ByVal Operation As EXG2ANTTLibCtl.BarOperationEnum) If (Operation = exPDM) Then Debug.Print "SchedulePDM ends" End If End SubThe output shows as follows:
BarResize invoked SchedulePDM starts BarResize invoked BarResize invoked SchedulePDM ends
If using the SchedulePDM method during a BarResizing event, you can see the order of the events in the following VB sample:
Private Sub G2antt1_BarResize(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal Key As Variant) Debug.Print "BarResize invoked" End Sub Private Sub G2antt1_BarResizing(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal Key As Variant) Debug.Print "BarResizing invoked" G2antt1.Items.SchedulePDM Item, Key End Sub Private Sub G2antt1_ChartStartChanging(ByVal Operation As EXG2ANTTLibCtl.BarOperationEnum) If (Operation = exPDM) Then Debug.Print "SchedulePDM starts" End If End Sub Private Sub G2antt1_ChartEndChanging(ByVal Operation As EXG2ANTTLibCtl.BarOperationEnum) If (Operation = exPDM) Then Debug.Print "SchedulePDM ends" End If End SubThe output shows as follows:
BarResizing invoked SchedulePDM starts BarResize invoked BarResize invoked SchedulePDM ends BarResize invoked
So, knowing that the BarResize event could be fired during the SchedulePDM itself, you can use the following technique to prevent calling again the SchedulePDM:
iPDMRunning = 0 event ChartStartChaning(Operation) if ( Operation == exPDM (12) ) iPDMRunning++ event ChartEndChaning(Operation) if ( Operation == exPDM (12) ) iPDMRunning-- event BarResize(Item,Key) if ( iPDMRunning == 0 ) Call SchedulePDM(Item,Key)
This snippet of code, ensures that the SchedulePDM is not called for inside BarResize event.
The SchedulePDM method handles bars as:
summary bars: DefineSummaryBars property defines a summary bar and child bars.
A link between two bars is:
For instance, a FS link between bar A and B, means that the bar B starts when bar A ends.
The Link(exLinkPDMWorkingDelay) property indicates the working units between 2 linked bars. For instance, if bar A is linked FS with a bar B and the exLinkPDMWorkingDelay is 2, the bar B starts after 2 working days once the bar A ends. The Link(exLinkPDMDelay) property indicates the units between 2 linked bars. For instance, if bar A is linked FS with a bar B and the exLinkPDMDelay is 2, the bar B starts after 2 days once the bar A ends.
The following screen shot shows the chart using different type of links before calling the SchedulePDM:
The following screen shot shows the chart using different type of links after calling the SchedulePDM:
and if we move the first bar and call again the SchedulePDM we get ( the sample preserve the working units for each bar ):
The following screen shot shows the activities, when exLinkPDMWorkingDelay property is set for links ( SF has 1 working day, FS has 2 working days and the FF has 3 working days delay ) :