excalendar - sample code

How can I assign a caption to a date?

VBA (MS Access, Excell...)

With Calendar1
	.AlignmentDay = 0
	.FixedCellWidth = 36
	.AutoSize = 0
	.MaxMonthX = 1
	.MaxMonthY = 1
	With .Events.Add(Calendar1.Date)
		.Caption = "<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1"
		.Marker = True
	End With
End With

VB6

With Calendar1
	.AlignmentDay = LeftAlignment
	.FixedCellWidth = 36
	.AutoSize = exFixedSize
	.MaxMonthX = 1
	.MaxMonthY = 1
	With .Events.Add(Calendar1.Date)
		.Caption = "<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1"
		.Marker = True
	End With
End With

VB.NET

With Excalendar1
	.AlignmentDay = exontrol.EXCALENDARLib.AlignmentEnum.LeftAlignment
	.FixedCellWidth = 36
	.AutoSize = exontrol.EXCALENDARLib.AutoSizeEnum.exFixedSize
	.MaxMonthX = 1
	.MaxMonthY = 1
	With .Events.Add(Excalendar1.Date)
		.Caption = "<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1"
		.Marker = True
	End With
End With

VB.NET for /COM

With AxCalendar1
	.AlignmentDay = EXCALENDARLib.AlignmentEnum.LeftAlignment
	.FixedCellWidth = 36
	.AutoSize = EXCALENDARLib.AutoSizeEnum.exFixedSize
	.MaxMonthX = 1
	.MaxMonthY = 1
	With .Events.Add(AxCalendar1.Date)
		.Caption = "<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1"
		.Marker = True
	End With
End With

C++

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

	#import <ExCalendar.dll>
	using namespace EXCALENDARLib;
*/
EXCALENDARLib::ICalendarPtr spCalendar1 = GetDlgItem(IDC_CALENDAR1)->GetControlUnknown();
spCalendar1->PutAlignmentDay(EXCALENDARLib::LeftAlignment);
spCalendar1->PutFixedCellWidth(36);
spCalendar1->PutAutoSize(EXCALENDARLib::exFixedSize);
spCalendar1->PutMaxMonthX(1);
spCalendar1->PutMaxMonthY(1);
EXCALENDARLib::IEventPtr var_Event = spCalendar1->GetEvents()->Add(spCalendar1->GetDate());
	var_Event->PutCaption(L"<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1");
	var_Event->PutMarker(VARIANT_TRUE);

C++ Builder

Calendar1->AlignmentDay = Excalendarlib_tlb::AlignmentEnum::LeftAlignment;
Calendar1->FixedCellWidth = 36;
Calendar1->AutoSize = Excalendarlib_tlb::AutoSizeEnum::exFixedSize;
Calendar1->MaxMonthX = 1;
Calendar1->MaxMonthY = 1;
Excalendarlib_tlb::IEventPtr var_Event = Calendar1->Events->Add(Calendar1->Date);
	var_Event->Caption = L"<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1";
	var_Event->Marker = true;

C#

excalendar1.AlignmentDay = exontrol.EXCALENDARLib.AlignmentEnum.LeftAlignment;
excalendar1.FixedCellWidth = 36;
excalendar1.AutoSize = exontrol.EXCALENDARLib.AutoSizeEnum.exFixedSize;
excalendar1.MaxMonthX = 1;
excalendar1.MaxMonthY = 1;
exontrol.EXCALENDARLib.Event var_Event = excalendar1.Events.Add(excalendar1.Date);
	var_Event.Caption = "<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1";
	var_Event.Marker = true;

JavaScript

<OBJECT classid="clsid:D8F4D09C-3FD1-4479-ABA3-4F195C20050C" id="Calendar1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
	Calendar1.AlignmentDay = 0;
	Calendar1.FixedCellWidth = 36;
	Calendar1.AutoSize = 0;
	Calendar1.MaxMonthX = 1;
	Calendar1.MaxMonthY = 1;
	var var_Event = Calendar1.Events.Add(Calendar1.Date);
		var_Event.Caption = "<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1";
		var_Event.Marker = true;
</SCRIPT>

C# for /COM

axCalendar1.AlignmentDay = EXCALENDARLib.AlignmentEnum.LeftAlignment;
axCalendar1.FixedCellWidth = 36;
axCalendar1.AutoSize = EXCALENDARLib.AutoSizeEnum.exFixedSize;
axCalendar1.MaxMonthX = 1;
axCalendar1.MaxMonthY = 1;
EXCALENDARLib.Event var_Event = axCalendar1.Events.Add(axCalendar1.Date);
	var_Event.Caption = "<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1";
	var_Event.Marker = true;

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_Event;
	anytype var_Event;
	;

	super();

	excalendar1.AlignmentDay(0/*LeftAlignment*/);
	excalendar1.FixedCellWidth(36);
	excalendar1.AutoSize(0/*exFixedSize*/);
	excalendar1.MaxMonthX(1);
	excalendar1.MaxMonthY(1);
	var_Event = COM::createFromObject(excalendar1.Events()).Add(excalendar1.Date()); com_Event = var_Event;
		com_Event.Caption("<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1");
		com_Event.Marker(true);
}

Delphi 8 (.NET only)

with AxCalendar1 do
begin
	AlignmentDay := EXCALENDARLib.AlignmentEnum.LeftAlignment;
	FixedCellWidth := 36;
	AutoSize := EXCALENDARLib.AutoSizeEnum.exFixedSize;
	MaxMonthX := 1;
	MaxMonthY := 1;
	with Events.Add(AxCalendar1.Date) do
	begin
		Caption := '<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1';
		Marker := True;
	end;
end

Delphi (standard)

with Calendar1 do
begin
	AlignmentDay := EXCALENDARLib_TLB.LeftAlignment;
	FixedCellWidth := 36;
	AutoSize := EXCALENDARLib_TLB.exFixedSize;
	MaxMonthX := 1;
	MaxMonthY := 1;
	with Events.Add(Calendar1.Date) do
	begin
		Caption := '<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1';
		Marker := True;
	end;
end

VFP

with thisform.Calendar1
	.AlignmentDay = 0
	.FixedCellWidth = 36
	.AutoSize = 0
	.MaxMonthX = 1
	.MaxMonthY = 1
	with .Events.Add(thisform.Calendar1.Date)
		.Caption = "<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1"
		.Marker = .T.
	endwith
endwith

dBASE Plus

local oCalendar,var_Event

oCalendar = form.Activex1.nativeObject
oCalendar.AlignmentDay = 0
oCalendar.FixedCellWidth = 36
oCalendar.AutoSize = 0
oCalendar.MaxMonthX = 1
oCalendar.MaxMonthY = 1
var_Event = oCalendar.Events.Add(oCalendar.Date)
	var_Event.Caption = "<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1"
	var_Event.Marker = true

XBasic (Alpha Five)

Dim oCalendar as P
Dim var_Event as P

oCalendar = topparent:CONTROL_ACTIVEX1.activex
oCalendar.AlignmentDay = 0
oCalendar.FixedCellWidth = 36
oCalendar.AutoSize = 0
oCalendar.MaxMonthX = 1
oCalendar.MaxMonthY = 1
var_Event = oCalendar.Events.Add(oCalendar.Date)
	var_Event.Caption = "<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1"
	var_Event.Marker = .t.

Visual Objects

local var_Event as IEvent

oDCOCX_Exontrol1:AlignmentDay := LeftAlignment
oDCOCX_Exontrol1:FixedCellWidth := 36
oDCOCX_Exontrol1:AutoSize := exFixedSize
oDCOCX_Exontrol1:MaxMonthX := 1
oDCOCX_Exontrol1:MaxMonthY := 1
var_Event := oDCOCX_Exontrol1:Events:Add(oDCOCX_Exontrol1:Date)
	var_Event:Caption := "<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1"
	var_Event:Marker := true

PowerBuilder

OleObject oCalendar,var_Event

oCalendar = ole_1.Object
oCalendar.AlignmentDay = 0
oCalendar.FixedCellWidth = 36
oCalendar.AutoSize = 0
oCalendar.MaxMonthX = 1
oCalendar.MaxMonthY = 1
var_Event = oCalendar.Events.Add(oCalendar.Date)
	var_Event.Caption = "<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1"
	var_Event.Marker = true

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	Set ComAlignmentDay to OLELeftAlignment
	Set ComFixedCellWidth to 36
	Set ComAutoSize to OLEexFixedSize
	Set ComMaxMonthX to 1
	Set ComMaxMonthY to 1
	Variant voEvents
	Get ComEvents to voEvents
	Handle hoEvents
	Get Create (RefClass(cComEvents)) to hoEvents
	Set pvComObject of hoEvents to voEvents
Variant vEvent
			Get ComDate to vEvent
				Variant voEvent
		Get ComAdd of hoEvents vEvent to voEvent
		Handle hoEvent
		Get Create (RefClass(cComEvent)) to hoEvent
		Set pvComObject of hoEvent to voEvent
			Set ComCaption of hoEvent to "<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1"
			Set ComMarker of hoEvent to True
		Send Destroy to hoEvent
	Send Destroy to hoEvents
End_Procedure

XBase++

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

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oCalendar
	LOCAL oEvent

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

	oCalendar := XbpActiveXControl():new( oForm:drawingArea )
	oCalendar:CLSID  := "Exontrol.Calendar.1" /*{D8F4D09C-3FD1-4479-ABA3-4F195C20050C}*/
	oCalendar:create(,, {10,60},{610,370} )

		oCalendar:AlignmentDay := 0/*LeftAlignment*/
		oCalendar:FixedCellWidth := 36
		oCalendar:AutoSize := 0/*exFixedSize*/
		oCalendar:MaxMonthX := 1
		oCalendar:MaxMonthY := 1
		oEvent := oCalendar:Events():Add(oCalendar:Date())
			oEvent:Caption := "<sha><b><%day%></b><r><off -4><sha;;0><fgcolor FF0000><font ;6>ev</sha></sha> 1"
			oEvent:Marker := .T.

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