Type | Description | |||
Item as Variant | A long expression that indicates the handle of the item where the cell is, or 0. If the Item parameter is 0, the ColIndex parameter must indicate the handle of the cell. | |||
ColIndex as Variant | A long expression that indicates the index of the column where a cell is divided, or a long expression that indicates the handle of the cell being divided, if the Item parameter is missing or it is zero. | |||
Variant | A long expression that indicates the handle of the parent cell. |
The following VB sample determines whether the cell is a master cell or an inner cell:
Private Function isMaster(ByVal g As EXGANTTLibCtl.Gantt, ByVal h As EXGANTTLibCtl.HITEM, ByVal c As Long) As Boolean With g.Items isMaster = .CellParent(h, c) = 0 End With End Function
The following VB sample determines the master cell ( the cell from where the splitting starts ):
Private Function getMaster(ByVal g As EXGANTTLibCtl.Gantt, ByVal h As EXGANTTLibCtl.HITEM, ByVal c As Long) As EXGANTTLibCtl.HCELL With g.Items Dim r As EXGANTTLibCtl.HCELL r = c If Not (h = 0) Then r = .ItemCell(h, c) End If While Not (.CellParent(, r) = 0) r = .CellParent(, r) Wend getMaster = r End With End Function
The following C++ sample determines whether the cell is a master cell or an inner cell:
#include "Items.h" static long V2I( VARIANT* pv, long nDefault = 0 ) { if ( pv ) { if ( pv->vt == VT_ERROR ) return nDefault; COleVariant vt; vt.ChangeType( VT_I4, pv ); return V_I4( &vt ); } return nDefault; } BOOL isMaster( CGantt gantt, long hItem, long nColIndex ) { return V2I( &gantt.GetItems().GetCellParent( COleVariant( hItem ), COleVariant( nColIndex ) ) ) == 0; }
The following C++ sample determines the master cell ( the cell from where the splitting starts ):
long getMaster( CGantt gantt, long hItem, long nColIndex ) { COleVariant vtMissing; V_VT( &vtMissing ) = VT_ERROR; CItems items = gantt.GetItems(); long r = nColIndex; if ( hItem ) r = items.GetItemCell( hItem, COleVariant( nColIndex ) ); long r2 = 0; while ( r2 = V2I( &items.GetCellParent( vtMissing, COleVariant( r ) ) ) ) r = r2; return r; }
The following VB.NET sample determines whether the cell is a master cell or an inner cell:
Private Function isMaster(ByVal g As AxEXGANTTLib.AxGantt, ByVal h As Long, ByVal c As Long) As Boolean With g.Items isMaster = .CellParent(h, c) = 0 End With End Function
The following VB.NET sample determines the master cell ( the cell from where the splitting starts ):
Shared Function getMaster(ByVal g As AxEXGANTTLib.AxGantt, ByVal h As Integer, ByVal c As Integer) As Integer With g.Items Dim r As Integer r = c If Not (h = 0) Then r = .ItemCell(h, c) End If While Not (.CellParent(, r) = 0) r = .CellParent(, r) End While getMaster = r End With End Function
The following C# sample determines whether the cell is a master cell or an inner cell:
private bool isMaster(AxEXGANTTLib.AxGantt gantt, int h, int c) { return Convert.ToInt32(gantt.Items.get_CellParent(h, c)) != 0; }
The following C# sample determines the master cell ( the cell from where the splitting starts ):
private long getMaster(AxEXGANTTLib.AxGantt g, int h, int c) { int r = c, r2 = 0; if ( h != 0 ) r = Convert.ToInt32( g.Items.get_ItemCell(h,c) ); r2 = Convert.ToInt32( g.Items.get_CellParent(null, r)); while ( r2 != 0) { r = r2; r2 = Convert.ToInt32( g.Items.get_CellParent(null, r)); } return r; }