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. | |||
Index as Variant | A long expression that indicates the index of the inner being requested. If the Index parameter is missing or it is zero, the InnerCell property retrieves the master cell. | |||
Variant | A long expression that indicates the handle of the inner cell. |
The following VB sample specifies whether a cell contains inner cells ( the function checks whether a cell is splitted ):
Private Function isSplit(ByVal g As EXGRIDLibCtl.Grid, ByVal h As EXGRIDLibCtl.HITEM, ByVal c As Long) As Boolean With g.Items isSplit = IIf(Not .InnerCell(h, c, 0) = .InnerCell(h, c, 1), True, False) End With End Function
The following VB sample gets the master cell:
Private Function getMaster(ByVal g As EXGRIDLibCtl.Grid, ByVal h As EXGRIDLibCtl.HITEM, ByVal c As Long) As EXGRIDLibCtl.HCELL With g.Items Dim r As EXGRIDLibCtl.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 VB following sample enumerates the list of the inner cells ( including the cell where the splitting starts ):
Private Sub enumSplit(ByVal g As EXGRIDLibCtl.Grid, ByVal h As EXGRIDLibCtl.HITEM, ByVal c As Long) With g.Items Dim i As Long i = -1 Do i = i + 1 Debug.Print .CellCaption(, .InnerCell(h, c, i)) Loop While Not (.InnerCell(h, c, i) = .InnerCell(h, c, i + 1)) End With End Sub
The VB following sample enumerates the list of inner cells, starting from the master cell:
enumSplit Grid1, 0, getMaster(Grid1, h, c)
The following VB sample counts the inner cells:
Private Function getInnerCount(ByVal g As EXGRIDLibCtl.Grid, ByVal h As EXGRIDLibCtl.HITEM, ByVal c As Long) As Long With g.Items Dim i As Long i = -1 Do i = i + 1 Loop While Not (.InnerCell(h, c, i) = .InnerCell(h, c, i + 1)) getInnerCount = i End With End Function
The following VC sample specifies whether a cell contains inner cells ( the function checks whether a cell is splitted ):
long V2I( VARIANT* pvtValue ) { COleVariant vtResult; vtResult.ChangeType( VT_I4, pvtValue ); return V_I4( &vtResult ); } BOOL isSplit( CGrid& grid, long h, long c ) { CItems items = grid.GetItems(); return V2I( &items.GetInnerCell( COleVariant( h ), COleVariant( c ), COleVariant( (long)0 ) ) ) != V2I( &items.GetInnerCell( COleVariant( h ), COleVariant( c ), COleVariant( (long)1 ) ) ); }
The following VC sample gets the master cell:
long getMaster( CGrid& grid, long h, long c ) { COleVariant vtMissing; V_VT( &vtMissing ) = VT_ERROR; CItems items = grid.GetItems(); long r = c; if ( h != 0 ) r = items.GetItemCell( h, COleVariant( c ) ); while ( V2I( &items.GetCellParent( vtMissing, COleVariant( r ) ) ) != 0 ) r = V2I( &items.GetCellParent( vtMissing, COleVariant( r ) ) ); return r; }
The following VC sample counts the inner cells:
long getInnerCount( CGrid& grid, long h, long c ) { CItems items = grid.GetItems(); COleVariant vtItem( h ), vtColumn( c ); long i = -1; do { i++; } while ( V2I( &items.GetInnerCell( vtItem, vtColumn, COleVariant( i ) ) ) != V2I( &items.GetInnerCell( vtItem, vtColumn, COleVariant( (long)(i + 1) ) ) ) ); return i; }
The following VB.NET sample splits the first visible cell in two cells:
With AxGrid1.Items Dim i As Object i = .SplitCell(.FirstVisibleItem, 0) .CellValue(Nothing, i) = "inner cell" End With
The following C# sample splits the first visible cell in two cells:
EXGRIDLib.Items items = axGrid1.Items; object i = items.get_SplitCell(items.FirstVisibleItem, 0); items.set_CellValue(null, i, "inner cell");
The following VFP sample splits the first visible cell in two cells:
with thisform.Grid1.Items local i i = .SplitCell(.FirstVisibleItem,0) local s, crlf crlf = chr(13) + chr(10) s = "Items" + crlf s = s + "{" + crlf s = s + "CellValue(," + str(i) + ") = " + chr(34) + "inner cell" + chr(34) + crlf s = s + "}" thisform.Grid1.Template = s endwith