explorerbar - sample code

How can I get the group of the item?

VBA (MS Access, Excell...)

With ExplorerBar1
	With .Groups.Add("Group 1")
		.AddItem "Item 1"
		.AddItem("Item 2").Group.Bold = True
		.AddItem "Item 3"
		.Expanded = True
	End With
End With

VB6

With ExplorerBar1
	With .Groups.Add("Group 1")
		.AddItem "Item 1"
		.AddItem("Item 2").Group.Bold = True
		.AddItem "Item 3"
		.Expanded = True
	End With
End With

VB.NET

With Explorerbar1
	With .Groups.Add("Group 1")
		.AddItem("Item 1")
		.AddItem("Item 2").Group.Bold = True
		.AddItem("Item 3")
		.Expanded = True
	End With
End With

VB.NET for /COM

With AxExplorerBar1
	With .Groups.Add("Group 1")
		.AddItem("Item 1")
		.AddItem("Item 2").Group.Bold = True
		.AddItem("Item 3")
		.Expanded = True
	End With
End With

C++

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

	#import <ExplorerBar.dll>
	using namespace EXPLORERBARLib;
*/
EXPLORERBARLib::IExplorerBarPtr spExplorerBar1 = GetDlgItem(IDC_EXPLORERBAR1)->GetControlUnknown();
EXPLORERBARLib::IGroupPtr var_Group = spExplorerBar1->GetGroups()->Add(L"Group 1");
	var_Group->AddItem(L"Item 1",vtMissing);
	var_Group->AddItem(L"Item 2",vtMissing)->GetGroup()->PutBold(VARIANT_TRUE);
	var_Group->AddItem(L"Item 3",vtMissing);
	var_Group->PutExpanded(VARIANT_TRUE);

C++ Builder

Explorerbarlib_tlb::IGroupPtr var_Group = ExplorerBar1->Groups->Add(L"Group 1");
	var_Group->AddItem(L"Item 1",TNoParam());
	var_Group->AddItem(L"Item 2",TNoParam())->Group->Bold = true;
	var_Group->AddItem(L"Item 3",TNoParam());
	var_Group->Expanded = true;

C#

exontrol.EXPLORERBARLib.Group var_Group = explorerbar1.Groups.Add("Group 1");
	var_Group.AddItem("Item 1",null);
	var_Group.AddItem("Item 2",null).Group.Bold = true;
	var_Group.AddItem("Item 3",null);
	var_Group.Expanded = true;

JavaScript

<OBJECT classid="clsid:3B1C55AF-6DC2-4146-811D-60DA6199DC72" id="ExplorerBar1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
	var var_Group = ExplorerBar1.Groups.Add("Group 1");
		var_Group.AddItem("Item 1",null);
		var_Group.AddItem("Item 2",null).Group.Bold = true;
		var_Group.AddItem("Item 3",null);
		var_Group.Expanded = true;
</SCRIPT>

C# for /COM

EXPLORERBARLib.Group var_Group = axExplorerBar1.Groups.Add("Group 1");
	var_Group.AddItem("Item 1",null);
	var_Group.AddItem("Item 2",null).Group.Bold = true;
	var_Group.AddItem("Item 3",null);
	var_Group.Expanded = true;

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_Group,com_Group1,com_Item;
	anytype var_Group,var_Group1,var_Item;
	;

	super();

	var_Group = COM::createFromObject(explorerbar1.Groups()).Add("Group 1"); com_Group = var_Group;
		com_Group.AddItem("Item 1");
		var_Item = COM::createFromObject(com_Group.AddItem("Item 2")); com_Item = var_Item;
		var_Group1 = COM::createFromObject(com_Item).Group(); com_Group1 = var_Group1;
		com_Group1.Bold(true);
		com_Group.AddItem("Item 3");
		com_Group.Expanded(true);
}

Delphi 8 (.NET only)

with AxExplorerBar1 do
begin
	with Groups.Add('Group 1') do
	begin
		AddItem('Item 1',Nil);
		AddItem('Item 2',Nil).Group.Bold := True;
		AddItem('Item 3',Nil);
		Expanded := True;
	end;
end

Delphi (standard)

with ExplorerBar1 do
begin
	with Groups.Add('Group 1') do
	begin
		AddItem('Item 1',Null);
		AddItem('Item 2',Null).Group.Bold := True;
		AddItem('Item 3',Null);
		Expanded := True;
	end;
end

VFP

with thisform.ExplorerBar1
	with .Groups.Add("Group 1")
		.AddItem("Item 1")
		.AddItem("Item 2").Group.Bold = .T.
		.AddItem("Item 3")
		.Expanded = .T.
	endwith
endwith

dBASE Plus

local oExplorerBar,var_Group,var_Group1

oExplorerBar = form.Activex1.nativeObject
var_Group = oExplorerBar.Groups.Add("Group 1")
	var_Group.AddItem("Item 1")
	// var_Group.AddItem("Item 2").Group.Bold = true
	var_Group1 = var_Group.AddItem("Item 2").Group
	with (oExplorerBar)
		TemplateDef = [Dim var_Group1]
		TemplateDef = var_Group1
		Template = [var_Group1.Bold = true]
	endwith
	var_Group.AddItem("Item 3")
	var_Group.Expanded = true

XBasic (Alpha Five)

Dim oExplorerBar as P
Dim var_Group as P
Dim var_Group1 as P

oExplorerBar = topparent:CONTROL_ACTIVEX1.activex
var_Group = oExplorerBar.Groups.Add("Group 1")
	var_Group.AddItem("Item 1")
	' var_Group.AddItem("Item 2").Group.Bold = .t.
	var_Group1 = var_Group.AddItem("Item 2").Group
	oExplorerBar.TemplateDef = "Dim var_Group1"
	oExplorerBar.TemplateDef = var_Group1
	oExplorerBar.Template = "var_Group1.Bold = True"

	var_Group.AddItem("Item 3")
	var_Group.Expanded = .t.

Visual Objects

local var_Group as IGroup

var_Group := oDCOCX_Exontrol1:Groups:Add("Group 1")
	var_Group:AddItem("Item 1",nil)
	var_Group:AddItem("Item 2",nil):Group:Bold := true
	var_Group:AddItem("Item 3",nil)
	var_Group:Expanded := true

PowerBuilder

OleObject oExplorerBar,var_Group

oExplorerBar = ole_1.Object
var_Group = oExplorerBar.Groups.Add("Group 1")
	var_Group.AddItem("Item 1")
	var_Group.AddItem("Item 2").Group.Bold = true
	var_Group.AddItem("Item 3")
	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 "Group 1" to voGroup
		Handle hoGroup
		Get Create (RefClass(cComGroup)) to hoGroup
		Set pvComObject of hoGroup to voGroup
			Get ComAddItem of hoGroup "Item 1" Nothing to Nothing
			Variant voItem
			Get ComAddItem of hoGroup "Item 2" Nothing to voItem
			Handle hoItem
			Get Create (RefClass(cComItem)) to hoItem
			Set pvComObject of hoItem to voItem
				Variant voGroup1
				Get ComGroup of hoItem to voGroup1
				Handle hoGroup1
				Get Create (RefClass(cComGroup)) to hoGroup1
				Set pvComObject of hoGroup1 to voGroup1
					Set ComBold of hoGroup1 to True
				Send Destroy to hoGroup1
			Send Destroy to hoItem
			Get ComAddItem of hoGroup "Item 3" Nothing to Nothing
			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 oExplorerBar
	LOCAL oGroup

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

	oExplorerBar := XbpActiveXControl():new( oForm:drawingArea )
	oExplorerBar:CLSID  := "Exontrol.ExplorerBar.1" /*{3B1C55AF-6DC2-4146-811D-60DA6199DC72}*/
	oExplorerBar:create(,, {10,60},{610,370} )

		oGroup := oExplorerBar:Groups():Add("Group 1")
			oGroup:AddItem("Item 1")
			oGroup:AddItem("Item 2"):Group():Bold := .T.
			oGroup:AddItem("Item 3")
			oGroup:Expanded := .T.

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