method Tree.GetItems (Options as Variant)
Gets the collection of items into a safe array,

 TypeDescription 
   Options as Variant By default, it is 0. If the Options is zero, the array contains the list of items as a table, else if the Options is not zero, and the number of columns is 1, the array includes the child items as they are displayed. In this case, the array may contains other arrays that specifies the child items.  
 ReturnDescription 
  VariantA safe array that holds the items in the control. The safe array being returned has two dimensions. The first dimension holds the collection of columns, and the second holds the cells.  
The GetItems method to get a safe array that holds the items in the control. The GetItems method gets the items as they are displayed, sorted and filtered. If the Options parameter is 0, the GetItems method collect the child items as well, no matter if the parent item is collapsed or expanded. Use the PutItems method to load an array to the control. The method returns nothing if the control has no columns or items. Use the Items property to access the items collection.

The following VB sample gets the items from a control and put them to the second one:

With Tree2
    .BeginUpdate
        .Columns.Clear
        Dim c As EXTREELibCtl.Column
        For Each c In Tree1.Columns
            .Columns.Add c.Caption
        Next
        .PutItems Tree1.GetItems
    .EndUpdate
End With 

The following C++ sample gets the items from a control an put to the second one:

#include "Items.h"
#include "Columns.h"
#include "Column.h"
m_tree2.BeginUpdate();
	CColumns columns = m_tree.GetColumns(), columns2 = m_tree2.GetColumns();
	for ( long i = 0; i < columns.GetCount(); i++ )
		columns2.Add( columns.GetItem( COleVariant( i ) ).GetCaption() );
	COleVariant vtMissing; V_VT( &vtMissing ) = VT_ERROR;
	COleVariant vtItems = m_tree.GetItems( vtMissing );
	m_tree2.PutItems( &vtItems, vtMissing );
m_tree2.EndUpdate();

The following C# sample gets the items from a control and put them to a second one:

axTree2.BeginUpdate();
for (int i = 0; i < axTree1.Columns.Count; i++)
	axTree2.Columns.Add(axTree1.Columns[i].Caption);
object vtItems = axTree1.GetItems("");
axTree2.PutItems(ref vtItems);
axTree2.EndUpdate();

The following VB.NET sample gets the items from a control and put them to a second one:

With AxTree2
    .BeginUpdate()
    Dim j As Integer
    For j = 0 To AxTree1.Columns.Count - 1
        .Columns.Add(AxTree1.Columns(j).Caption)
    Next
    Dim vtItems As Object
    vtItems = AxTree1.GetItems("")
    .PutItems(vtItems)
    .EndUpdate()
End With

The following VFP sample gets the items from a control and put them to a second one:

local i
with thisform.Tree2
	.BeginUpdate()
	for i = 0 to thisform.Tree1.Columns.Count - 1
		.Columns.Add( thisform.Tree1.Columns(i).Caption )
	next
	local array vtItems[1]
	vtItems = thisform.Tree1.GetItems("")
	.PutItems( @vtItems )
	.EndUpdate()
endwith

 


Send comments on this topic.
© 1999-2008 Exontrol Inc, Software. All rights reserved.