property Items.InnerCell ([Item as Variant], [ColIndex as Variant], [Index as Variant]) as Variant
Retrieves the inner cell. /*not supported in the lite version*/

 TypeDescription 
   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.  
Use the InnerCell property to get the inner cell. The InnerCell( , , 0 ) property always retrieves the same cell. The InnerCell( , , 1 ) retrieves the first inner cell, and so on. The InnerCells property always retrieves a non empty value. For instance, if a cell contains only two splited cells, the InnerCell( , , 3 ), or InnerCell( , , 4 ), and so on, always retrieves the last inner cell. The SplitCell method splits a cell in two cells ( the newly created cell is called inner cell ). Use the CellParent property to get the parent of the inner cell. Use the CellItem property to get the item that's the owner of the cell. Use the CellWidth property to specify the width of the inner cell. Use the CellParent property to determine whether the cell is a master cell or an inner cell. If the CellParent property gets 0, it means that the cell is master, else it is inner.

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 EXTREELibCtl.Tree, ByVal h As EXTREELibCtl.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 EXTREELibCtl.Tree, ByVal h As EXTREELibCtl.HITEM, ByVal c As Long) As EXTREELibCtl.HCELL
    With g.Items
        Dim r As EXTREELibCtl.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 VB sample counts the inner cells:

Private Function getInnerCount(ByVal g As EXTREELibCtl.Tree, ByVal h As EXTREELibCtl.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 C++ 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( CTree& tree, long h, long c )
{
	CItems items = tree.GetItems();
	return V2I( &items.GetInnerCell( COleVariant( h ), COleVariant( c ), COleVariant( (long)0 ) ) ) != V2I( &items.GetInnerCell( COleVariant( h ), COleVariant( c ), COleVariant( (long)1 ) ) );
}

The following C++ sample gets the master cell:

long getMaster( CTree& tree, long h, long c )
{
	COleVariant vtMissing; V_VT( &vtMissing ) = VT_ERROR;
	CItems items = tree.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 C++ sample counts the inner cells:

long getInnerCount( CTree& tree, long h, long c )
{
	CItems items = tree.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 AxTree1.Items
    Dim i As Object
    i = .SplitCell(.FirstVisibleItem, 0)
    .CellCaption(Nothing, i) = "inner cell"
End With

The following C# sample splits the first visible cell in two cells:

EXTREELib.Items items = axTree1.Items;
object i = items.get_SplitCell(items.FirstVisibleItem, 0);
items.set_CellCaption(null, i, "inner cell");

The following VFP sample splits the first visible cell in two cells:

with thisform.Tree1.Items
	local i
	i = .SplitCell(.FirstVisibleItem,0)
	local s, crlf
	crlf = chr(13) + chr(10)
	s = "Items" + crlf
	s = s + "{" + crlf
	s = s + "CellCaption(," + str(i) + ") = " + chr(34) + "inner cell" + chr(34) + crlf
	s = s + "}"
	thisform.Tree1.Template = s
endwith
 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.