exorgchart - sample code

How can I add a child node?

VBA (MS Access, Excell...)

With ChartView1
	.HasButtons = -1
	With .Nodes
		.Add "Child 1",0,"C1"
		.Add "Child 2",0,"C2"
		.Add "Sub Child 1","C1","SC1"
		.Add "Sub Sub Shild 1","SC1"
	End With
End With

VB6

With ChartView1
	.HasButtons = exPlus
	With .Nodes
		.Add "Child 1",0,"C1"
		.Add "Child 2",0,"C2"
		.Add "Sub Child 1","C1","SC1"
		.Add "Sub Sub Shild 1","SC1"
	End With
End With

VB.NET

With Exchartview1
	.HasButtons = exontrol.EXORGCHARTLib.ExpandButtonEnum.exPlus
	With .Nodes
		.Add("Child 1",0,"C1")
		.Add("Child 2",0,"C2")
		.Add("Sub Child 1","C1","SC1")
		.Add("Sub Sub Shild 1","SC1")
	End With
End With

VB.NET for /COM

With AxChartView1
	.HasButtons = EXORGCHARTLib.ExpandButtonEnum.exPlus
	With .Nodes
		.Add("Child 1",0,"C1")
		.Add("Child 2",0,"C2")
		.Add("Sub Child 1","C1","SC1")
		.Add("Sub Sub Shild 1","SC1")
	End With
End With

C++

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

	#import <ExOrgChart.dll>
	using namespace EXORGCHARTLib;
*/
EXORGCHARTLib::IChartViewPtr spChartView1 = GetDlgItem(IDC_CHARTVIEW1)->GetControlUnknown();
spChartView1->PutHasButtons(EXORGCHARTLib::exPlus);
EXORGCHARTLib::INodesPtr var_Nodes = spChartView1->GetNodes();
	var_Nodes->Add(L"Child 1",long(0),"C1",vtMissing,vtMissing);
	var_Nodes->Add(L"Child 2",long(0),"C2",vtMissing,vtMissing);
	var_Nodes->Add(L"Sub Child 1","C1","SC1",vtMissing,vtMissing);
	var_Nodes->Add(L"Sub Sub Shild 1","SC1",vtMissing,vtMissing,vtMissing);

C++ Builder

ChartView1->HasButtons = Exorgchartlib_tlb::ExpandButtonEnum::exPlus;
Exorgchartlib_tlb::INodesPtr var_Nodes = ChartView1->Nodes;
	var_Nodes->Add(L"Child 1",TVariant(0),TVariant("C1"),TNoParam(),TNoParam());
	var_Nodes->Add(L"Child 2",TVariant(0),TVariant("C2"),TNoParam(),TNoParam());
	var_Nodes->Add(L"Sub Child 1",TVariant("C1"),TVariant("SC1"),TNoParam(),TNoParam());
	var_Nodes->Add(L"Sub Sub Shild 1",TVariant("SC1"),TNoParam(),TNoParam(),TNoParam());

C#

exchartview1.HasButtons = exontrol.EXORGCHARTLib.ExpandButtonEnum.exPlus;
exontrol.EXORGCHARTLib.Nodes var_Nodes = exchartview1.Nodes;
	var_Nodes.Add("Child 1",0,"C1",null,null);
	var_Nodes.Add("Child 2",0,"C2",null,null);
	var_Nodes.Add("Sub Child 1","C1","SC1",null,null);
	var_Nodes.Add("Sub Sub Shild 1","SC1",null,null,null);

JavaScript

<OBJECT classid="clsid:F4DFE455-01FE-420E-A088-64346DCC3791" id="ChartView1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
	ChartView1.HasButtons = -1;
	var var_Nodes = ChartView1.Nodes;
		var_Nodes.Add("Child 1",0,"C1",null,null);
		var_Nodes.Add("Child 2",0,"C2",null,null);
		var_Nodes.Add("Sub Child 1","C1","SC1",null,null);
		var_Nodes.Add("Sub Sub Shild 1","SC1",null,null,null);
</SCRIPT>

C# for /COM

axChartView1.HasButtons = EXORGCHARTLib.ExpandButtonEnum.exPlus;
EXORGCHARTLib.Nodes var_Nodes = axChartView1.Nodes;
	var_Nodes.Add("Child 1",0,"C1",null,null);
	var_Nodes.Add("Child 2",0,"C2",null,null);
	var_Nodes.Add("Sub Child 1","C1","SC1",null,null);
	var_Nodes.Add("Sub Sub Shild 1","SC1",null,null,null);

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_Nodes;
	anytype var_Nodes;
	;

	super();

	exchartview1.HasButtons(-1/*exPlus*/);
	var_Nodes = exchartview1.Nodes(); com_Nodes = var_Nodes;
		com_Nodes.Add("Child 1",COMVariant::createFromInt(0),"C1");
		com_Nodes.Add("Child 2",COMVariant::createFromInt(0),"C2");
		com_Nodes.Add("Sub Child 1","C1","SC1");
		com_Nodes.Add("Sub Sub Shild 1","SC1");
}

Delphi 8 (.NET only)

with AxChartView1 do
begin
	HasButtons := EXORGCHARTLib.ExpandButtonEnum.exPlus;
	with Nodes do
	begin
		Add('Child 1',TObject(0),'C1',Nil,Nil);
		Add('Child 2',TObject(0),'C2',Nil,Nil);
		Add('Sub Child 1','C1','SC1',Nil,Nil);
		Add('Sub Sub Shild 1','SC1',Nil,Nil,Nil);
	end;
end

Delphi (standard)

with ChartView1 do
begin
	HasButtons := EXORGCHARTLib_TLB.exPlus;
	with Nodes do
	begin
		Add('Child 1',OleVariant(0),'C1',Null,Null);
		Add('Child 2',OleVariant(0),'C2',Null,Null);
		Add('Sub Child 1','C1','SC1',Null,Null);
		Add('Sub Sub Shild 1','SC1',Null,Null,Null);
	end;
end

VFP

with thisform.ChartView1
	.HasButtons = -1
	with .Nodes
		.Add("Child 1",0,"C1")
		.Add("Child 2",0,"C2")
		.Add("Sub Child 1","C1","SC1")
		.Add("Sub Sub Shild 1","SC1")
	endwith
endwith

dBASE Plus

local oChartView,var_Nodes

oChartView = form.Activex1.nativeObject
oChartView.HasButtons = -1
var_Nodes = oChartView.Nodes
	var_Nodes.Add("Child 1",0,"C1")
	var_Nodes.Add("Child 2",0,"C2")
	var_Nodes.Add("Sub Child 1","C1","SC1")
	var_Nodes.Add("Sub Sub Shild 1","SC1")

XBasic (Alpha Five)

Dim oChartView as P
Dim var_Nodes as P

oChartView = topparent:CONTROL_ACTIVEX1.activex
oChartView.HasButtons = -1
var_Nodes = oChartView.Nodes
	var_Nodes.Add("Child 1",0,"C1")
	var_Nodes.Add("Child 2",0,"C2")
	var_Nodes.Add("Sub Child 1","C1","SC1")
	var_Nodes.Add("Sub Sub Shild 1","SC1")

Visual Objects

local var_Nodes as INodes

oDCOCX_Exontrol1:HasButtons := exPlus
var_Nodes := oDCOCX_Exontrol1:Nodes
	var_Nodes:Add("Child 1",0,"C1",nil,nil)
	var_Nodes:Add("Child 2",0,"C2",nil,nil)
	var_Nodes:Add("Sub Child 1","C1","SC1",nil,nil)
	var_Nodes:Add("Sub Sub Shild 1","SC1",nil,nil,nil)

PowerBuilder

OleObject oChartView,var_Nodes

oChartView = ole_1.Object
oChartView.HasButtons = -1
var_Nodes = oChartView.Nodes
	var_Nodes.Add("Child 1",0,"C1")
	var_Nodes.Add("Child 2",0,"C2")
	var_Nodes.Add("Sub Child 1","C1","SC1")
	var_Nodes.Add("Sub Sub Shild 1","SC1")

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	Set ComHasButtons to OLEexPlus
	Variant voNodes
	Get ComNodes to voNodes
	Handle hoNodes
	Get Create (RefClass(cComNodes)) to hoNodes
	Set pvComObject of hoNodes to voNodes
		Get ComAdd of hoNodes "Child 1" 0 "C1" Nothing Nothing to Nothing
		Get ComAdd of hoNodes "Child 2" 0 "C2" Nothing Nothing to Nothing
		Get ComAdd of hoNodes "Sub Child 1" "C1" "SC1" Nothing Nothing to Nothing
		Get ComAdd of hoNodes "Sub Sub Shild 1" "SC1" Nothing Nothing Nothing to Nothing
	Send Destroy to hoNodes
End_Procedure

XBase++

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

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oChartView
	LOCAL oNodes

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

	oChartView := XbpActiveXControl():new( oForm:drawingArea )
	oChartView:CLSID  := "Exontrol.ChartView.1" /*{F4DFE455-01FE-420E-A088-64346DCC3791}*/
	oChartView:create(,, {10,60},{610,370} )

		oChartView:HasButtons := -1/*exPlus*/
		oNodes := oChartView:Nodes()
			oNodes:Add("Child 1",0,"C1")
			oNodes:Add("Child 2",0,"C2")
			oNodes:Add("Sub Child 1","C1","SC1")
			oNodes:Add("Sub Sub Shild 1","SC1")

	oForm:Show()
	DO WHILE nEvent != xbeP_Quit
		nEvent := AppEvent( @mp1, @mp2, @oXbp )
		oXbp:handleEvent( nEvent, mp1, mp2 )
	ENDDO 
RETURN
Copyright 1999-2017 Exontrol. All rights reserved.