explorertree - sample code

How do I highlight in bold the numbers greater than a value?

VBA (MS Access, Excell...)

With ExplorerTree1
	With .Groups.Add("Default")
		.ConditionalFormats.Add("dbl(%0) >= 10").Bold = True
		.Items.AddItem 1
		.Items.AddItem 2
		.Items.AddItem 10
		.Items.AddItem 20
		.Expanded = True
	End With
End With

VB6

With ExplorerTree1
	With .Groups.Add("Default")
		.ConditionalFormats.Add("dbl(%0) >= 10").Bold = True
		.Items.AddItem 1
		.Items.AddItem 2
		.Items.AddItem 10
		.Items.AddItem 20
		.Expanded = True
	End With
End With

VB.NET

With Explorertree1
	With .Groups.Add("Default")
		.ConditionalFormats.Add("dbl(%0) >= 10").Bold = True
		.Items.AddItem(1)
		.Items.AddItem(2)
		.Items.AddItem(10)
		.Items.AddItem(20)
		.Expanded = True
	End With
End With

VB.NET for /COM

With AxExplorerTree1
	With .Groups.Add("Default")
		.ConditionalFormats.Add("dbl(%0) >= 10").Bold = True
		.Items.AddItem(1)
		.Items.AddItem(2)
		.Items.AddItem(10)
		.Items.AddItem(20)
		.Expanded = True
	End With
End With

C++

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

	#import <ExplorerTree.dll>
	using namespace EXPLORERTREELib;
*/
EXPLORERTREELib::IExplorerTreePtr spExplorerTree1 = GetDlgItem(IDC_EXPLORERTREE1)->GetControlUnknown();
EXPLORERTREELib::IGroupPtr var_Group = spExplorerTree1->GetGroups()->Add(L"Default");
	var_Group->GetConditionalFormats()->Add(L"dbl(%0) >= 10",vtMissing)->PutBold(VARIANT_TRUE);
	var_Group->GetItems()->AddItem(long(1));
	var_Group->GetItems()->AddItem(long(2));
	var_Group->GetItems()->AddItem(long(10));
	var_Group->GetItems()->AddItem(long(20));
	var_Group->PutExpanded(VARIANT_TRUE);

C++ Builder

Explorertreelib_tlb::IGroupPtr var_Group = ExplorerTree1->Groups->Add(L"Default");
	var_Group->ConditionalFormats->Add(L"dbl(%0) >= 10",TNoParam())->Bold = true;
	var_Group->Items->AddItem(TVariant(1));
	var_Group->Items->AddItem(TVariant(2));
	var_Group->Items->AddItem(TVariant(10));
	var_Group->Items->AddItem(TVariant(20));
	var_Group->Expanded = true;

C#

exontrol.EXPLORERTREELib.Group var_Group = explorertree1.Groups.Add("Default");
	var_Group.ConditionalFormats.Add("dbl(%0) >= 10",null).Bold = true;
	var_Group.Items.AddItem(1);
	var_Group.Items.AddItem(2);
	var_Group.Items.AddItem(10);
	var_Group.Items.AddItem(20);
	var_Group.Expanded = true;

JavaScript

<OBJECT classid="clsid:1036744E-4103-4987-BA7A-BB6C35BD5852" id="ExplorerTree1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
	var var_Group = ExplorerTree1.Groups.Add("Default");
		var_Group.ConditionalFormats.Add("dbl(%0) >= 10",null).Bold = true;
		var_Group.Items.AddItem(1);
		var_Group.Items.AddItem(2);
		var_Group.Items.AddItem(10);
		var_Group.Items.AddItem(20);
		var_Group.Expanded = true;
</SCRIPT>

C# for /COM

EXPLORERTREELib.Group var_Group = axExplorerTree1.Groups.Add("Default");
	var_Group.ConditionalFormats.Add("dbl(%0) >= 10",null).Bold = true;
	var_Group.Items.AddItem(1);
	var_Group.Items.AddItem(2);
	var_Group.Items.AddItem(10);
	var_Group.Items.AddItem(20);
	var_Group.Expanded = true;

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_ConditionalFormat,com_ConditionalFormats,com_Group,com_Items;
	anytype var_ConditionalFormat,var_ConditionalFormats,var_Group,var_Items;
	;

	super();

	var_Group = COM::createFromObject(explorertree1.Groups()).Add("Default"); com_Group = var_Group;
		var_ConditionalFormats = COM::createFromObject(com_Group.ConditionalFormats()); com_ConditionalFormats = var_ConditionalFormats;
		var_ConditionalFormat = COM::createFromObject(com_ConditionalFormats).Add("dbl(%0) >= 10"); com_ConditionalFormat = var_ConditionalFormat;
		com_ConditionalFormat.Bold(true);
		var_Items = COM::createFromObject(com_Group.Items()); com_Items = var_Items;
		com_Items.AddItem(COMVariant::createFromInt(1));
		var_Items = COM::createFromObject(com_Group.Items()); com_Items = var_Items;
		com_Items.AddItem(COMVariant::createFromInt(2));
		var_Items = COM::createFromObject(com_Group.Items()); com_Items = var_Items;
		com_Items.AddItem(COMVariant::createFromInt(10));
		var_Items = COM::createFromObject(com_Group.Items()); com_Items = var_Items;
		com_Items.AddItem(COMVariant::createFromInt(20));
		com_Group.Expanded(true);
}

Delphi 8 (.NET only)

with AxExplorerTree1 do
begin
	with Groups.Add('Default') do
	begin
		ConditionalFormats.Add('dbl(%0) >= 10',Nil).Bold := True;
		Items.AddItem(TObject(1));
		Items.AddItem(TObject(2));
		Items.AddItem(TObject(10));
		Items.AddItem(TObject(20));
		Expanded := True;
	end;
end

Delphi (standard)

with ExplorerTree1 do
begin
	with Groups.Add('Default') do
	begin
		ConditionalFormats.Add('dbl(%0) >= 10',Null).Bold := True;
		Items.AddItem(OleVariant(1));
		Items.AddItem(OleVariant(2));
		Items.AddItem(OleVariant(10));
		Items.AddItem(OleVariant(20));
		Expanded := True;
	end;
end

VFP

with thisform.ExplorerTree1
	with .Groups.Add("Default")
		.ConditionalFormats.Add("dbl(%0) >= 10").Bold = .T.
		.Items.AddItem(1)
		.Items.AddItem(2)
		.Items.AddItem(10)
		.Items.AddItem(20)
		.Expanded = .T.
	endwith
endwith

dBASE Plus

local oExplorerTree,var_ConditionalFormat,var_Group

oExplorerTree = form.Activex1.nativeObject
var_Group = oExplorerTree.Groups.Add("Default")
	// var_Group.ConditionalFormats.Add("dbl(%0) >= 10").Bold = true
	var_ConditionalFormat = var_Group.ConditionalFormats.Add("dbl(%0) >= 10")
	with (oExplorerTree)
		TemplateDef = [Dim var_ConditionalFormat]
		TemplateDef = var_ConditionalFormat
		Template = [var_ConditionalFormat.Bold = true]
	endwith
	var_Group.Items.AddItem(1)
	var_Group.Items.AddItem(2)
	var_Group.Items.AddItem(10)
	var_Group.Items.AddItem(20)
	var_Group.Expanded = true

XBasic (Alpha Five)

Dim oExplorerTree as P
Dim var_ConditionalFormat as P
Dim var_Group as P

oExplorerTree = topparent:CONTROL_ACTIVEX1.activex
var_Group = oExplorerTree.Groups.Add("Default")
	' var_Group.ConditionalFormats.Add("dbl(%0) >= 10").Bold = .t.
	var_ConditionalFormat = var_Group.ConditionalFormats.Add("dbl(%0) >= 10")
	oExplorerTree.TemplateDef = "Dim var_ConditionalFormat"
	oExplorerTree.TemplateDef = var_ConditionalFormat
	oExplorerTree.Template = "var_ConditionalFormat.Bold = True"

	var_Group.Items.AddItem(1)
	var_Group.Items.AddItem(2)
	var_Group.Items.AddItem(10)
	var_Group.Items.AddItem(20)
	var_Group.Expanded = .t.

Visual Objects

local var_Group as IGroup

var_Group := oDCOCX_Exontrol1:Groups:Add("Default")
	var_Group:ConditionalFormats:Add("dbl(%0) >= 10",nil):Bold := true
	var_Group:Items:AddItem(1)
	var_Group:Items:AddItem(2)
	var_Group:Items:AddItem(10)
	var_Group:Items:AddItem(20)
	var_Group:Expanded := true

PowerBuilder

OleObject oExplorerTree,var_Group

oExplorerTree = ole_1.Object
var_Group = oExplorerTree.Groups.Add("Default")
	var_Group.ConditionalFormats.Add("dbl(%0) >= 10").Bold = true
	var_Group.Items.AddItem(1)
	var_Group.Items.AddItem(2)
	var_Group.Items.AddItem(10)
	var_Group.Items.AddItem(20)
	var_Group.Expanded = true

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	Variant voGroups
	Get ComGroups to voGroups
	Handle hoGroups
	Get Create (RefClass(cComGroups)) to hoGroups
	Set pvComObject of hoGroups to voGroups
		Variant voGroup
		Get ComAdd of hoGroups "Default" to voGroup
		Handle hoGroup
		Get Create (RefClass(cComGroup)) to hoGroup
		Set pvComObject of hoGroup to voGroup
			Variant voConditionalFormats
			Get ComConditionalFormats of hoGroup to voConditionalFormats
			Handle hoConditionalFormats
			Get Create (RefClass(cComConditionalFormats)) to hoConditionalFormats
			Set pvComObject of hoConditionalFormats to voConditionalFormats
				Variant voConditionalFormat
				Get ComAdd of hoConditionalFormats "dbl(%0) >= 10" Nothing to voConditionalFormat
				Handle hoConditionalFormat
				Get Create (RefClass(cComConditionalFormat)) to hoConditionalFormat
				Set pvComObject of hoConditionalFormat to voConditionalFormat
					Set ComBold of hoConditionalFormat to True
				Send Destroy to hoConditionalFormat
			Send Destroy to hoConditionalFormats
			Variant voItems
			Get ComItems of hoGroup to voItems
			Handle hoItems
			Get Create (RefClass(cComItems)) to hoItems
			Set pvComObject of hoItems to voItems
				Get ComAddItem of hoItems 1 to Nothing
			Send Destroy to hoItems
			Variant voItems1
			Get ComItems of hoGroup to voItems1
			Handle hoItems1
			Get Create (RefClass(cComItems)) to hoItems1
			Set pvComObject of hoItems1 to voItems1
				Get ComAddItem of hoItems1 2 to Nothing
			Send Destroy to hoItems1
			Variant voItems2
			Get ComItems of hoGroup to voItems2
			Handle hoItems2
			Get Create (RefClass(cComItems)) to hoItems2
			Set pvComObject of hoItems2 to voItems2
				Get ComAddItem of hoItems2 10 to Nothing
			Send Destroy to hoItems2
			Variant voItems3
			Get ComItems of hoGroup to voItems3
			Handle hoItems3
			Get Create (RefClass(cComItems)) to hoItems3
			Set pvComObject of hoItems3 to voItems3
				Get ComAddItem of hoItems3 20 to Nothing
			Send Destroy to hoItems3
			Set ComExpanded of hoGroup to True
		Send Destroy to hoGroup
	Send Destroy to hoGroups
End_Procedure

XBase++

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

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oExplorerTree
	LOCAL oGroup

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

	oExplorerTree := XbpActiveXControl():new( oForm:drawingArea )
	oExplorerTree:CLSID  := "Exontrol.ExplorerTree.1" /*{1036744E-4103-4987-BA7A-BB6C35BD5852}*/
	oExplorerTree:create(,, {10,60},{610,370} )

		oGroup := oExplorerTree:Groups():Add("Default")
			oGroup:ConditionalFormats():Add("dbl(%0) >= 10"):Bold := .T.
			oGroup:Items():AddItem(1)
			oGroup:Items():AddItem(2)
			oGroup:Items():AddItem(10)
			oGroup:Items():AddItem(20)
			oGroup:Expanded := .T.

	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.