extree - sample code

Does your control support partial-check ( three states ) feature for each column?

VBA (MS Access, Excell...)

With Tree1
	.LinesAtRoot = -1
	With .Columns.Add("P1")
		.Def(0) = True
		.PartialCheck = True
	End With
	With .Columns.Add("P2")
		.Def(0) = True
		.PartialCheck = True
	End With
	With .Items
		h = .AddItem("Root")
		.InsertItem h,0,"Child 1"
		.InsertItem h,0,"Child 2"
		.ExpandItem(h) = True
	End With
End With

VB6

With Tree1
	.LinesAtRoot = exLinesAtRoot
	With .Columns.Add("P1")
		.Def(exCellHasCheckBox) = True
		.PartialCheck = True
	End With
	With .Columns.Add("P2")
		.Def(exCellHasCheckBox) = True
		.PartialCheck = True
	End With
	With .Items
		h = .AddItem("Root")
		.InsertItem h,0,"Child 1"
		.InsertItem h,0,"Child 2"
		.ExpandItem(h) = True
	End With
End With

VB.NET

Dim h
With Extree1
	.LinesAtRoot = exontrol.EXTREELib.LinesAtRootEnum.exLinesAtRoot
	With .Columns.Add("P1")
		.set_Def(exontrol.EXTREELib.DefColumnEnum.exCellHasCheckBox,True)
		.PartialCheck = True
	End With
	With .Columns.Add("P2")
		.set_Def(exontrol.EXTREELib.DefColumnEnum.exCellHasCheckBox,True)
		.PartialCheck = True
	End With
	With .Items
		h = .AddItem("Root")
		.InsertItem(h,0,"Child 1")
		.InsertItem(h,0,"Child 2")
		.set_ExpandItem(h,True)
	End With
End With

VB.NET for /COM

Dim h
With AxTree1
	.LinesAtRoot = EXTREELib.LinesAtRootEnum.exLinesAtRoot
	With .Columns.Add("P1")
		.Def(EXTREELib.DefColumnEnum.exCellHasCheckBox) = True
		.PartialCheck = True
	End With
	With .Columns.Add("P2")
		.Def(EXTREELib.DefColumnEnum.exCellHasCheckBox) = True
		.PartialCheck = True
	End With
	With .Items
		h = .AddItem("Root")
		.InsertItem(h,0,"Child 1")
		.InsertItem(h,0,"Child 2")
		.ExpandItem(h) = True
	End With
End With

C++

/*
	Copy and paste the following directives to your header file as
	it defines the namespace 'EXTREELib' for the library: 'ExTree 1.0 Control Library'

	#import <ExTree.dll>
	using namespace EXTREELib;
*/
EXTREELib::ITreePtr spTree1 = GetDlgItem(IDC_TREE1)->GetControlUnknown();
spTree1->PutLinesAtRoot(EXTREELib::exLinesAtRoot);
EXTREELib::IColumnPtr var_Column = ((EXTREELib::IColumnPtr)(spTree1->GetColumns()->Add(L"P1")));
	var_Column->PutDef(EXTREELib::exCellHasCheckBox,VARIANT_TRUE);
	var_Column->PutPartialCheck(VARIANT_TRUE);
EXTREELib::IColumnPtr var_Column1 = ((EXTREELib::IColumnPtr)(spTree1->GetColumns()->Add(L"P2")));
	var_Column1->PutDef(EXTREELib::exCellHasCheckBox,VARIANT_TRUE);
	var_Column1->PutPartialCheck(VARIANT_TRUE);
EXTREELib::IItemsPtr var_Items = spTree1->GetItems();
	long h = var_Items->AddItem("Root");
	var_Items->InsertItem(h,long(0),"Child 1");
	var_Items->InsertItem(h,long(0),"Child 2");
	var_Items->PutExpandItem(h,VARIANT_TRUE);

C++ Builder

Tree1->LinesAtRoot = Extreelib_tlb::LinesAtRootEnum::exLinesAtRoot;
Extreelib_tlb::IColumnPtr var_Column = Tree1->Columns->Add(L"P1");
	var_Column->set_Def(Extreelib_tlb::DefColumnEnum::exCellHasCheckBox,TVariant(true));
	var_Column->PartialCheck = true;
Extreelib_tlb::IColumnPtr var_Column1 = Tree1->Columns->Add(L"P2");
	var_Column1->set_Def(Extreelib_tlb::DefColumnEnum::exCellHasCheckBox,TVariant(true));
	var_Column1->PartialCheck = true;
Extreelib_tlb::IItemsPtr var_Items = Tree1->Items;
	long h = var_Items->AddItem(TVariant("Root"));
	var_Items->InsertItem(h,TVariant(0),TVariant("Child 1"));
	var_Items->InsertItem(h,TVariant(0),TVariant("Child 2"));
	var_Items->set_ExpandItem(h,true);

C#

extree1.LinesAtRoot = exontrol.EXTREELib.LinesAtRootEnum.exLinesAtRoot;
exontrol.EXTREELib.Column var_Column = (extree1.Columns.Add("P1") as exontrol.EXTREELib.Column);
	var_Column.set_Def(exontrol.EXTREELib.DefColumnEnum.exCellHasCheckBox,true);
	var_Column.PartialCheck = true;
exontrol.EXTREELib.Column var_Column1 = (extree1.Columns.Add("P2") as exontrol.EXTREELib.Column);
	var_Column1.set_Def(exontrol.EXTREELib.DefColumnEnum.exCellHasCheckBox,true);
	var_Column1.PartialCheck = true;
exontrol.EXTREELib.Items var_Items = extree1.Items;
	int h = var_Items.AddItem("Root");
	var_Items.InsertItem(h,0,"Child 1");
	var_Items.InsertItem(h,0,"Child 2");
	var_Items.set_ExpandItem(h,true);

JavaScript

<OBJECT classid="clsid:3C5FC763-72BA-4B97-9985-81862E9251F2" id="Tree1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
	Tree1.LinesAtRoot = -1;
	var var_Column = Tree1.Columns.Add("P1");
		var_Column.Def(0) = true;
		var_Column.PartialCheck = true;
	var var_Column1 = Tree1.Columns.Add("P2");
		var_Column1.Def(0) = true;
		var_Column1.PartialCheck = true;
	var var_Items = Tree1.Items;
		var h = var_Items.AddItem("Root");
		var_Items.InsertItem(h,0,"Child 1");
		var_Items.InsertItem(h,0,"Child 2");
		var_Items.ExpandItem(h) = true;
</SCRIPT>

C# for /COM

axTree1.LinesAtRoot = EXTREELib.LinesAtRootEnum.exLinesAtRoot;
EXTREELib.Column var_Column = (axTree1.Columns.Add("P1") as EXTREELib.Column);
	var_Column.set_Def(EXTREELib.DefColumnEnum.exCellHasCheckBox,true);
	var_Column.PartialCheck = true;
EXTREELib.Column var_Column1 = (axTree1.Columns.Add("P2") as EXTREELib.Column);
	var_Column1.set_Def(EXTREELib.DefColumnEnum.exCellHasCheckBox,true);
	var_Column1.PartialCheck = true;
EXTREELib.Items var_Items = axTree1.Items;
	int h = var_Items.AddItem("Root");
	var_Items.InsertItem(h,0,"Child 1");
	var_Items.InsertItem(h,0,"Child 2");
	var_Items.set_ExpandItem(h,true);

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_Column,com_Column1,com_Items;
	anytype var_Column,var_Column1,var_Items;
	int h;
	;

	super();

	extree1.LinesAtRoot(-1/*exLinesAtRoot*/);
	var_Column = COM::createFromVariant(extree1.Columns().Add("P1")); com_Column = var_Column;
		com_Column.Def(0/*exCellHasCheckBox*/,COMVariant::createFromBoolean(true));
		com_Column.PartialCheck(true);
	var_Column1 = COM::createFromVariant(extree1.Columns().Add("P2")); com_Column1 = var_Column1;
		com_Column1.Def(0/*exCellHasCheckBox*/,COMVariant::createFromBoolean(true));
		com_Column1.PartialCheck(true);
	var_Items = extree1.Items(); com_Items = var_Items;
		h = com_Items.AddItem("Root");
		com_Items.InsertItem(h,COMVariant::createFromInt(0),"Child 1");
		com_Items.InsertItem(h,COMVariant::createFromInt(0),"Child 2");
		com_Items.ExpandItem(h,true);
}

Delphi 8 (.NET only)

with AxTree1 do
begin
	LinesAtRoot := EXTREELib.LinesAtRootEnum.exLinesAtRoot;
	with (Columns.Add('P1') as EXTREELib.Column) do
	begin
		Def[EXTREELib.DefColumnEnum.exCellHasCheckBox] := TObject(True);
		PartialCheck := True;
	end;
	with (Columns.Add('P2') as EXTREELib.Column) do
	begin
		Def[EXTREELib.DefColumnEnum.exCellHasCheckBox] := TObject(True);
		PartialCheck := True;
	end;
	with Items do
	begin
		h := AddItem('Root');
		InsertItem(h,TObject(0),'Child 1');
		InsertItem(h,TObject(0),'Child 2');
		ExpandItem[h] := True;
	end;
end

Delphi (standard)

with Tree1 do
begin
	LinesAtRoot := EXTREELib_TLB.exLinesAtRoot;
	with (IUnknown(Columns.Add('P1')) as EXTREELib_TLB.Column) do
	begin
		Def[EXTREELib_TLB.exCellHasCheckBox] := OleVariant(True);
		PartialCheck := True;
	end;
	with (IUnknown(Columns.Add('P2')) as EXTREELib_TLB.Column) do
	begin
		Def[EXTREELib_TLB.exCellHasCheckBox] := OleVariant(True);
		PartialCheck := True;
	end;
	with Items do
	begin
		h := AddItem('Root');
		InsertItem(h,OleVariant(0),'Child 1');
		InsertItem(h,OleVariant(0),'Child 2');
		ExpandItem[h] := True;
	end;
end

VFP

with thisform.Tree1
	.LinesAtRoot = -1
	with .Columns.Add("P1")
		.Def(0) = .T.
		.PartialCheck = .T.
	endwith
	with .Columns.Add("P2")
		.Def(0) = .T.
		.PartialCheck = .T.
	endwith
	with .Items
		h = .AddItem("Root")
		.InsertItem(h,0,"Child 1")
		.InsertItem(h,0,"Child 2")
		.ExpandItem(h) = .T.
	endwith
endwith

dBASE Plus

local h,oTree,var_Column,var_Column1,var_Items

oTree = form.Activex1.nativeObject
oTree.LinesAtRoot = -1
var_Column = oTree.Columns.Add("P1")
	// var_Column.Def(0) = true
	with (oTree)
		TemplateDef = [Dim var_Column]
		TemplateDef = var_Column
		Template = [var_Column.Def(0) = true]
	endwith
	var_Column.PartialCheck = true
var_Column1 = oTree.Columns.Add("P2")
	// var_Column1.Def(0) = true
	with (oTree)
		TemplateDef = [Dim var_Column1]
		TemplateDef = var_Column1
		Template = [var_Column1.Def(0) = true]
	endwith
	var_Column1.PartialCheck = true
var_Items = oTree.Items
	h = var_Items.AddItem("Root")
	var_Items.InsertItem(h,0,"Child 1")
	var_Items.InsertItem(h,0,"Child 2")
	// var_Items.ExpandItem(h) = true
	with (oTree)
		TemplateDef = [Dim var_Items,h]
		TemplateDef = var_Items
		TemplateDef = h
		Template = [var_Items.ExpandItem(h) = true]
	endwith

XBasic (Alpha Five)

Dim h as N
Dim oTree as P
Dim var_Column as P
Dim var_Column1 as P
Dim var_Items as P

oTree = topparent:CONTROL_ACTIVEX1.activex
oTree.LinesAtRoot = -1
var_Column = oTree.Columns.Add("P1")
	' var_Column.Def(0) = .t.
	oTree.TemplateDef = "Dim var_Column"
	oTree.TemplateDef = var_Column
	oTree.Template = "var_Column.Def(0) = True"

	var_Column.PartialCheck = .t.
var_Column1 = oTree.Columns.Add("P2")
	' var_Column1.Def(0) = .t.
	oTree.TemplateDef = "Dim var_Column1"
	oTree.TemplateDef = var_Column1
	oTree.Template = "var_Column1.Def(0) = True"

	var_Column1.PartialCheck = .t.
var_Items = oTree.Items
	h = var_Items.AddItem("Root")
	var_Items.InsertItem(h,0,"Child 1")
	var_Items.InsertItem(h,0,"Child 2")
	' var_Items.ExpandItem(h) = .t.
	oTree.TemplateDef = "Dim var_Items,h"
	oTree.TemplateDef = var_Items
	oTree.TemplateDef = h
	oTree.Template = "var_Items.ExpandItem(h) = True"


Visual Objects

local var_Column,var_Column1 as IColumn
local var_Items as IItems
local h as USUAL

oDCOCX_Exontrol1:LinesAtRoot := exLinesAtRoot
var_Column := IColumn{oDCOCX_Exontrol1:Columns:Add("P1")}
	var_Column:[Def,exCellHasCheckBox] := true
	var_Column:PartialCheck := true
var_Column1 := IColumn{oDCOCX_Exontrol1:Columns:Add("P2")}
	var_Column1:[Def,exCellHasCheckBox] := true
	var_Column1:PartialCheck := true
var_Items := oDCOCX_Exontrol1:Items
	h := var_Items:AddItem("Root")
	var_Items:InsertItem(h,0,"Child 1")
	var_Items:InsertItem(h,0,"Child 2")
	var_Items:[ExpandItem,h] := true

PowerBuilder

OleObject oTree,var_Column,var_Column1,var_Items
any h

oTree = ole_1.Object
oTree.LinesAtRoot = -1
var_Column = oTree.Columns.Add("P1")
	var_Column.Def(0,true)
	var_Column.PartialCheck = true
var_Column1 = oTree.Columns.Add("P2")
	var_Column1.Def(0,true)
	var_Column1.PartialCheck = true
var_Items = oTree.Items
	h = var_Items.AddItem("Root")
	var_Items.InsertItem(h,0,"Child 1")
	var_Items.InsertItem(h,0,"Child 2")
	var_Items.ExpandItem(h,true)

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	Set ComLinesAtRoot to OLEexLinesAtRoot
	Variant voColumns
	Get ComColumns to voColumns
	Handle hoColumns
	Get Create (RefClass(cComColumns)) to hoColumns
	Set pvComObject of hoColumns to voColumns
		Variant voColumn
		Get ComAdd of hoColumns "P1" to voColumn
		Handle hoColumn
		Get Create (RefClass(cComColumn)) to hoColumn
		Set pvComObject of hoColumn to voColumn
			Set ComDef of hoColumn OLEexCellHasCheckBox to True
			Set ComPartialCheck of hoColumn to True
		Send Destroy to hoColumn
	Send Destroy to hoColumns
	Variant voColumns1
	Get ComColumns to voColumns1
	Handle hoColumns1
	Get Create (RefClass(cComColumns)) to hoColumns1
	Set pvComObject of hoColumns1 to voColumns1
		Variant voColumn1
		Get ComAdd of hoColumns1 "P2" to voColumn1
		Handle hoColumn1
		Get Create (RefClass(cComColumn)) to hoColumn1
		Set pvComObject of hoColumn1 to voColumn1
			Set ComDef of hoColumn1 OLEexCellHasCheckBox to True
			Set ComPartialCheck of hoColumn1 to True
		Send Destroy to hoColumn1
	Send Destroy to hoColumns1
	Variant voItems
	Get ComItems to voItems
	Handle hoItems
	Get Create (RefClass(cComItems)) to hoItems
	Set pvComObject of hoItems to voItems
		Variant h
		Get ComAddItem of hoItems "Root" to h
		Get ComInsertItem of hoItems h 0 "Child 1" to Nothing
		Get ComInsertItem of hoItems h 0 "Child 2" to Nothing
		Set ComExpandItem of hoItems h to True
	Send Destroy to hoItems
End_Procedure

XBase++

#include "AppEvent.ch"
#include "ActiveX.ch"

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oColumn,oColumn1
	LOCAL oItems
	LOCAL oTree
	LOCAL h

	oForm := XbpDialog():new( AppDesktop() )
	oForm:drawingArea:clipChildren := .T.
	oForm:create( ,,{100,100}, {640,480},, .F. )
	oForm:close  := {|| PostAppEvent( xbeP_Quit )}

	oTree := XbpActiveXControl():new( oForm:drawingArea )
	oTree:CLSID  := "Exontrol.Tree.1" /*{3C5FC763-72BA-4B97-9985-81862E9251F2}*/
	oTree:create(,, {10,60},{610,370} )

		oTree:LinesAtRoot := -1/*exLinesAtRoot*/
		oColumn := oTree:Columns():Add("P1")
			oColumn:SetProperty("Def",0/*exCellHasCheckBox*/,.T.)
			oColumn:PartialCheck := .T.
		oColumn1 := oTree:Columns():Add("P2")
			oColumn1:SetProperty("Def",0/*exCellHasCheckBox*/,.T.)
			oColumn1:PartialCheck := .T.
		oItems := oTree:Items()
			h := oItems:AddItem("Root")
			oItems:InsertItem(h,0,"Child 1")
			oItems:InsertItem(h,0,"Child 2")
			oItems:SetProperty("ExpandItem",h,.T.)

	oForm:Show()
	DO WHILE nEvent != xbeP_Quit
		nEvent := AppEvent( @mp1, @mp2, @oXbp )
		oXbp:handleEvent( nEvent, mp1, mp2 )
	ENDDO 
RETURN