extreecube - sample code

How can I display a calendar control?

VBA (MS Access, Excell...)

' FaceCalendarValueChanged event - Notifies that the user selects a new date/value into a face of the calendar type.
Private Sub TreeCube1_FaceCalendarValueChanged(ByVal Calendar As Object)
	With TreeCube1
		Debug.Print( Calendar )
	End With
End Sub

With TreeCube1
	With .FrontFace.CreateCalendar
		.Value = #1/2/2001#
		.MonthNames = .LocMonthNames()
		.WeekDays = .LocWeekDays(2)
		.FirstWeekDay = .LocFirstWeekDay ' .LocFirstWeekDay
		.AutoSize = 1
	End With
End With

VB6

' FaceCalendarValueChanged event - Notifies that the user selects a new date/value into a face of the calendar type.
Private Sub TreeCube1_FaceCalendarValueChanged(ByVal Calendar As EXTREECUBELibCtl.IFaceCalendar)
	With TreeCube1
		Debug.Print( Calendar )
	End With
End Sub

With TreeCube1
	With .FrontFace.CreateCalendar
		.Value = #1/2/2001#
		.MonthNames = .LocMonthNames()
		.WeekDays = .LocWeekDays(2)
		.FirstWeekDay = .LocFirstWeekDay
		.AutoSize = exFitClient
	End With
End With

VB.NET

' FaceCalendarValueChanged event - Notifies that the user selects a new date/value into a face of the calendar type.
Private Sub Extreecube1_FaceCalendarValueChanged(ByVal sender As System.Object,ByVal Calendar As exontrol.EXTREECUBELib.FaceCalendar) Handles Extreecube1.FaceCalendarValueChanged
	With Extreecube1
		Debug.Print( Calendar )
	End With
End Sub

With Extreecube1
	With .FrontFace.CreateCalendar()
		.Value = #1/2/2001#
		.MonthNames = .get_LocMonthNames()
		.WeekDays = .get_LocWeekDays(2)
		.FirstWeekDay = .LocFirstWeekDay
		.AutoSize = exontrol.EXTREECUBELib.AutoSizeEnum.exFitClient
	End With
End With

VB.NET for /COM

' FaceCalendarValueChanged event - Notifies that the user selects a new date/value into a face of the calendar type.
Private Sub AxTreeCube1_FaceCalendarValueChanged(ByVal sender As System.Object, ByVal e As AxEXTREECUBELib._ITreeCubeEvents_FaceCalendarValueChangedEvent) Handles AxTreeCube1.FaceCalendarValueChanged
	With AxTreeCube1
		Debug.Print( e.calendar )
	End With
End Sub

With AxTreeCube1
	With .FrontFace.CreateCalendar()
		.Value = #1/2/2001#
		.MonthNames = .LocMonthNames()
		.WeekDays = .LocWeekDays(2)
		.FirstWeekDay = .LocFirstWeekDay
		.AutoSize = EXTREECUBELib.AutoSizeEnum.exFitClient
	End With
End With

C++

// FaceCalendarValueChanged event - Notifies that the user selects a new date/value into a face of the calendar type.
void OnFaceCalendarValueChangedTreeCube1(LPDISPATCH   Calendar)
{
	/*
		Copy and paste the following directives to your header file as
		it defines the namespace 'EXTREECUBELib' for the library: 'ExTreeCube 1.0 Control Library'
		#import <ExTreeCube.dll>
		using namespace EXTREECUBELib;
	*/
	EXTREECUBELib::ITreeCubePtr spTreeCube1 = GetDlgItem(IDC_TREECUBE1)->GetControlUnknown();
	OutputDebugStringW( L"Calendar" );
}

EXTREECUBELib::ITreeCubePtr spTreeCube1 = GetDlgItem(IDC_TREECUBE1)->GetControlUnknown();
EXTREECUBELib::IFaceCalendarPtr var_FaceCalendar = spTreeCube1->GetFrontFace()->CreateCalendar();
	var_FaceCalendar->PutValue(COleDateTime(2001,1,2,0,00,00).operator DATE());
	var_FaceCalendar->PutMonthNames(var_FaceCalendar->GetLocMonthNames(vtMissing));
	var_FaceCalendar->PutWeekDays(var_FaceCalendar->GetLocWeekDays(long(2)));
	var_FaceCalendar->PutFirstWeekDay(var_FaceCalendar->GetLocFirstWeekDay());
	var_FaceCalendar->PutAutoSize(EXTREECUBELib::exFitClient);

C++ Builder

// FaceCalendarValueChanged event - Notifies that the user selects a new date/value into a face of the calendar type.
void __fastcall TForm1::TreeCube1FaceCalendarValueChanged(TObject *Sender,Extreecubelib_tlb::IFaceCalendar   *Calendar)
{
	OutputDebugString( L"Calendar" );
}

Extreecubelib_tlb::IFaceCalendarPtr var_FaceCalendar = TreeCube1->FrontFace->CreateCalendar();
	var_FaceCalendar->set_Value(TVariant(TDateTime(2001,1,2).operator double()));
	var_FaceCalendar->MonthNames = var_FaceCalendar->get_LocMonthNames(TNoParam());
	var_FaceCalendar->WeekDays = var_FaceCalendar->get_LocWeekDays(TVariant(2));
	var_FaceCalendar->FirstWeekDay = var_FaceCalendar->LocFirstWeekDay;
	var_FaceCalendar->AutoSize = Extreecubelib_tlb::AutoSizeEnum::exFitClient;

C#

// FaceCalendarValueChanged event - Notifies that the user selects a new date/value into a face of the calendar type.
private void extreecube1_FaceCalendarValueChanged(object sender,exontrol.EXTREECUBELib.FaceCalendar   Calendar)
{
	System.Diagnostics.Debug.Print( Calendar.ToString() );
}
//this.extreecube1.FaceCalendarValueChanged += new exontrol.EXTREECUBELib.exg2antt.FaceCalendarValueChangedEventHandler(this.extreecube1_FaceCalendarValueChanged);

exontrol.EXTREECUBELib.FaceCalendar var_FaceCalendar = extreecube1.FrontFace.CreateCalendar();
	var_FaceCalendar.Value = Convert.ToDateTime("1/2/2001",System.Globalization.CultureInfo.GetCultureInfo("en-US"));
	var_FaceCalendar.MonthNames = var_FaceCalendar.get_LocMonthNames(null);
	var_FaceCalendar.WeekDays = var_FaceCalendar.get_LocWeekDays(2);
	var_FaceCalendar.FirstWeekDay = var_FaceCalendar.LocFirstWeekDay;
	var_FaceCalendar.AutoSize = exontrol.EXTREECUBELib.AutoSizeEnum.exFitClient;

JScript/JavaScript

<BODY onload="Init()">
<SCRIPT FOR="TreeCube1" EVENT="FaceCalendarValueChanged(Calendar)" LANGUAGE="JScript">
	alert( Calendar );
</SCRIPT>

<OBJECT CLASSID="clsid:13A5B44B-DBB7-42F2-AE2B-943A6CF6C8B9" id="TreeCube1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
function Init()
{
	var var_FaceCalendar = TreeCube1.FrontFace.CreateCalendar();
		var_FaceCalendar.Value = "1/2/2001";
		var_FaceCalendar.MonthNames = var_FaceCalendar.LocMonthNames(null);
		var_FaceCalendar.WeekDays = var_FaceCalendar.LocWeekDays(2);
		var_FaceCalendar.FirstWeekDay = var_FaceCalendar.LocFirstWeekDay;
		var_FaceCalendar.AutoSize = 1;
}
</SCRIPT>
</BODY>

VBScript

<BODY onload="Init()">
<SCRIPT LANGUAGE="VBScript">
Function TreeCube1_FaceCalendarValueChanged(Calendar)
	With TreeCube1
		alert( Calendar )
	End With
End Function
</SCRIPT>

<OBJECT CLASSID="clsid:13A5B44B-DBB7-42F2-AE2B-943A6CF6C8B9" id="TreeCube1"></OBJECT>

<SCRIPT LANGUAGE="VBScript">
Function Init()
	With TreeCube1
		With .FrontFace.CreateCalendar
			.Value = #1/2/2001#
			.MonthNames = .LocMonthNames()
			.WeekDays = .LocWeekDays(2)
			.FirstWeekDay = .LocFirstWeekDay ' .LocFirstWeekDay
			.AutoSize = 1
		End With
	End With
End Function
</SCRIPT>
</BODY>

C# for /COM

// FaceCalendarValueChanged event - Notifies that the user selects a new date/value into a face of the calendar type.
private void axTreeCube1_FaceCalendarValueChanged(object sender, AxEXTREECUBELib._ITreeCubeEvents_FaceCalendarValueChangedEvent e)
{
	System.Diagnostics.Debug.Print( e.calendar.ToString() );
}
//this.axTreeCube1.FaceCalendarValueChanged += new AxEXTREECUBELib._ITreeCubeEvents_FaceCalendarValueChangedEventHandler(this.axTreeCube1_FaceCalendarValueChanged);

EXTREECUBELib.FaceCalendar var_FaceCalendar = axTreeCube1.FrontFace.CreateCalendar();
	var_FaceCalendar.Value = Convert.ToDateTime("1/2/2001",System.Globalization.CultureInfo.GetCultureInfo("en-US"));
	var_FaceCalendar.MonthNames = var_FaceCalendar.get_LocMonthNames(null);
	var_FaceCalendar.WeekDays = var_FaceCalendar.get_LocWeekDays(2);
	var_FaceCalendar.FirstWeekDay = var_FaceCalendar.LocFirstWeekDay;
	var_FaceCalendar.AutoSize = EXTREECUBELib.AutoSizeEnum.exFitClient;

X++ (Dynamics Ax 2009)

// FaceCalendarValueChanged event - Notifies that the user selects a new date/value into a face of the calendar type.
void onEvent_FaceCalendarValueChanged(COM   _Calendar)
{
	;
	print( _Calendar );
}

public void init()
{
	COM com_FaceCalendar;
	anytype var_FaceCalendar;
	;

	super();

	var_FaceCalendar = extreecube1.FrontFace().CreateCalendar(); com_FaceCalendar = var_FaceCalendar;
		com_FaceCalendar.Value(COMVariant::createFromDate(str2Date("1/2/2001",213)));
		com_FaceCalendar.MonthNames(com_FaceCalendar.LocMonthNames());
		com_FaceCalendar.WeekDays(com_FaceCalendar.LocWeekDays(COMVariant::createFromInt(2)));
		com_FaceCalendar.FirstWeekDay(com_FaceCalendar.LocFirstWeekDay());
		com_FaceCalendar.AutoSize(1/*exFitClient*/);
}

Delphi 8 (.NET only)

// FaceCalendarValueChanged event - Notifies that the user selects a new date/value into a face of the calendar type.
procedure TWinForm1.AxTreeCube1_FaceCalendarValueChanged(sender: System.Object; e: AxEXTREECUBELib._ITreeCubeEvents_FaceCalendarValueChangedEvent);
begin
	with AxTreeCube1 do
	begin
		OutputDebugString( e.calendar );
	end
end;

with AxTreeCube1 do
begin
	with FrontFace.CreateCalendar() do
	begin
		Value := '1/2/2001';
		MonthNames := LocMonthNames[Nil];
		WeekDays := LocWeekDays[TObject(2)];
		FirstWeekDay := LocFirstWeekDay;
		AutoSize := EXTREECUBELib.AutoSizeEnum.exFitClient;
	end;
end

Delphi (standard)

// FaceCalendarValueChanged event - Notifies that the user selects a new date/value into a face of the calendar type.
procedure TForm1.TreeCube1FaceCalendarValueChanged(ASender: TObject; Calendar : IFaceCalendar);
begin
	with TreeCube1 do
	begin
		OutputDebugString( Calendar );
	end
end;

with TreeCube1 do
begin
	with FrontFace.CreateCalendar() do
	begin
		Value := '1/2/2001';
		MonthNames := LocMonthNames[Null];
		WeekDays := LocWeekDays[OleVariant(2)];
		FirstWeekDay := LocFirstWeekDay;
		AutoSize := EXTREECUBELib_TLB.exFitClient;
	end;
end

VFP

*** FaceCalendarValueChanged event - Notifies that the user selects a new date/value into a face of the calendar type. ***
LPARAMETERS Calendar
	with thisform.TreeCube1
		DEBUGOUT( Calendar )
	endwith

with thisform.TreeCube1
	with .FrontFace.CreateCalendar
		.Value = {^2001-1-2}
		.MonthNames = .LocMonthNames()
		.WeekDays = .LocWeekDays(2)
		.FirstWeekDay = .LocFirstWeekDay && .LocFirstWeekDay
		.AutoSize = 1
	endwith
endwith

dBASE Plus

/*
with (this.EXTREECUBEACTIVEXCONTROL1.nativeObject)
	FaceCalendarValueChanged = class::nativeObject_FaceCalendarValueChanged
endwith
*/
// Notifies that the user selects a new date/value into a face of the calendar type.
function nativeObject_FaceCalendarValueChanged(Calendar)
	oTreeCube = form.EXTREECUBEACTIVEXCONTROL1.nativeObject
	? Str(Calendar) 
return

local oTreeCube,var_FaceCalendar

oTreeCube = form.EXTREECUBEACTIVEXCONTROL1.nativeObject
var_FaceCalendar = oTreeCube.FrontFace.CreateCalendar()
	var_FaceCalendar.Value = "01/02/2001"
	var_FaceCalendar.MonthNames = var_FaceCalendar.LocMonthNames()
	var_FaceCalendar.WeekDays = var_FaceCalendar.LocWeekDays(2)
	var_FaceCalendar.FirstWeekDay = var_FaceCalendar.LocFirstWeekDay
	var_FaceCalendar.AutoSize = 1

XBasic (Alpha Five)

' Notifies that the user selects a new date/value into a face of the calendar type.
function FaceCalendarValueChanged as v (Calendar  as  OLE::Exontrol.TreeCube.1::IFaceCalendar)
	oTreeCube = topparent:CONTROL_ACTIVEX1.activex
	? Calendar 
end function

Dim oTreeCube as P
Dim var_FaceCalendar as P

oTreeCube = topparent:CONTROL_ACTIVEX1.activex
var_FaceCalendar = oTreeCube.FrontFace.CreateCalendar()
	var_FaceCalendar.Value = {01/02/2001}
	var_FaceCalendar.MonthNames = var_FaceCalendar.LocMonthNames()
	var_FaceCalendar.WeekDays = var_FaceCalendar.LocWeekDays(2)
	var_FaceCalendar.FirstWeekDay = var_FaceCalendar.LocFirstWeekDay
	var_FaceCalendar.AutoSize = 1

Visual Objects

METHOD OCX_Exontrol1FaceCalendarValueChanged(Calendar) CLASS MainDialog
	// FaceCalendarValueChanged event - Notifies that the user selects a new date/value into a face of the calendar type.
	OutputDebugString(String2Psz( AsString(Calendar) ))
RETURN NIL

local var_FaceCalendar as IFaceCalendar

var_FaceCalendar := oDCOCX_Exontrol1:FrontFace:CreateCalendar()
	var_FaceCalendar:Value := SToD("20010102")
	var_FaceCalendar:MonthNames := var_FaceCalendar:[LocMonthNames,nil]
	var_FaceCalendar:WeekDays := var_FaceCalendar:[LocWeekDays,2]
	var_FaceCalendar:FirstWeekDay := var_FaceCalendar:LocFirstWeekDay
	var_FaceCalendar:AutoSize := exFitClient

PowerBuilder

/*begin event FaceCalendarValueChanged(oleobject  Calendar) - Notifies that the user selects a new date/value into a face of the calendar type.*/
/*
	oTreeCube = ole_1.Object
	MessageBox("Information",string( String(Calendar) ))
*/
/*end event FaceCalendarValueChanged*/

OleObject oTreeCube,var_FaceCalendar

oTreeCube = ole_1.Object
var_FaceCalendar = oTreeCube.FrontFace.CreateCalendar()
	var_FaceCalendar.Value = 2001-01-02
	var_FaceCalendar.MonthNames = var_FaceCalendar.LocMonthNames()
	var_FaceCalendar.WeekDays = var_FaceCalendar.LocWeekDays(2)
	var_FaceCalendar.FirstWeekDay = var_FaceCalendar.LocFirstWeekDay
	var_FaceCalendar.AutoSize = 1

Visual DataFlex

// Notifies that the user selects a new date/value into a face of the calendar type.
Procedure OnComFaceCalendarValueChanged Variant   llCalendar
	Forward Send OnComFaceCalendarValueChanged llCalendar
	Showln llCalendar
End_Procedure

Procedure OnCreate
	Forward Send OnCreate
	Variant voFace
	Get ComFrontFace to voFace
	Handle hoFace
	Get Create (RefClass(cComFace)) to hoFace
	Set pvComObject of hoFace to voFace
		Variant voFaceCalendar
		Get ComCreateCalendar of hoFace to voFaceCalendar
		Handle hoFaceCalendar
		Get Create (RefClass(cComFaceCalendar)) to hoFaceCalendar
		Set pvComObject of hoFaceCalendar to voFaceCalendar
			Set ComValue of hoFaceCalendar to "1/2/2001"
			Set ComMonthNames of hoFaceCalendar to (ComLocMonthNames(hoFaceCalendar,Nothing))
			Set ComWeekDays of hoFaceCalendar to (ComLocWeekDays(hoFaceCalendar,2))
			Set ComFirstWeekDay of hoFaceCalendar to (ComLocFirstWeekDay(hoFaceCalendar))
			Set ComAutoSize of hoFaceCalendar to OLEexFitClient
		Send Destroy to hoFaceCalendar
	Send Destroy to hoFace
End_Procedure

XBase++

PROCEDURE OnFaceCalendarValueChanged(oTreeCube,Calendar)
	DevOut( Transform(Calendar,"") )
RETURN

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

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oFaceCalendar
	LOCAL oTreeCube

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

	oTreeCube := XbpActiveXControl():new( oForm:drawingArea )
	oTreeCube:CLSID  := "Exontrol.TreeCube.1" /*{13A5B44B-DBB7-42F2-AE2B-943A6CF6C8B9}*/
	oTreeCube:create(,, {10,60},{610,370} )

		oTreeCube:FaceCalendarValueChanged := {|Calendar| OnFaceCalendarValueChanged(oTreeCube,Calendar)} /*Notifies that the user selects a new date/value into a face of the calendar type.*/

		oFaceCalendar := oTreeCube:FrontFace():CreateCalendar()
			oFaceCalendar:Value := "01/02/2001"
			oFaceCalendar:MonthNames := oFaceCalendar:LocMonthNames()
			oFaceCalendar:WeekDays := oFaceCalendar:LocWeekDays(2)
			oFaceCalendar:FirstWeekDay := oFaceCalendar:LocFirstWeekDay()
			oFaceCalendar:AutoSize := 1/*exFitClient*/

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