How can I programatically add events to the control?
VBA (MS Access, Excell...)
With Schedule1
.BeginUpdate
.Calendar.Selection = #5/24/2012#
With .Events
.Add #5/24/2012 10:00:00 AM#,#5/24/2012 0:00:00 PM#
.Add #5/24/2012 10:45:00 AM#,#5/24/2012 0:30:00 PM#
.Add #5/24/2012 11:30:00 AM#,#5/24/2012 1:30:00 PM#
End With
.EndUpdate
End With
VB6
With Schedule1
.BeginUpdate
.Calendar.Selection = #5/24/2012#
With .Events
.Add #5/24/2012 10:00:00 AM#,#5/24/2012 0:00:00 PM#
.Add #5/24/2012 10:45:00 AM#,#5/24/2012 0:30:00 PM#
.Add #5/24/2012 11:30:00 AM#,#5/24/2012 1:30:00 PM#
End With
.EndUpdate
End With
VB.NET
With Exschedule1
.BeginUpdate()
.Calendar.Selection = #5/24/2012#
With .Events
.Add(#5/24/2012 10:00:00 AM#,#5/24/2012 0:00:00 PM#)
.Add(#5/24/2012 10:45:00 AM#,#5/24/2012 0:30:00 PM#)
.Add(#5/24/2012 11:30:00 AM#,#5/24/2012 1:30:00 PM#)
End With
.EndUpdate()
End With
VB.NET for /COM
With AxSchedule1
.BeginUpdate()
.Calendar.Selection = #5/24/2012#
With .Events
.Add(#5/24/2012 10:00:00 AM#,#5/24/2012 0:00:00 PM#)
.Add(#5/24/2012 10:45:00 AM#,#5/24/2012 0:30:00 PM#)
.Add(#5/24/2012 11:30:00 AM#,#5/24/2012 1:30:00 PM#)
End With
.EndUpdate()
End With
C++
/*
Copy and paste the following directives to your header file as
it defines the namespace 'EXSCHEDULELib' for the library: 'ExSchedule 1.0 Control Library'
#import <ExSchedule.dll>
using namespace EXSCHEDULELib;
*/
EXSCHEDULELib::ISchedulePtr spSchedule1 = GetDlgItem(IDC_SCHEDULE1)->GetControlUnknown();
spSchedule1->BeginUpdate();
spSchedule1->GetCalendar()->PutSelection("5/24/2012");
EXSCHEDULELib::IEventsPtr var_Events = spSchedule1->GetEvents();
var_Events->Add("5/24/2012 10:00:00 AM","5/24/2012 12:00:00 PM");
var_Events->Add("5/24/2012 10:45:00 AM","5/24/2012 12:30:00 PM");
var_Events->Add("5/24/2012 11:30:00 AM","5/24/2012 1:30:00 PM");
spSchedule1->EndUpdate();
C++ Builder
Schedule1->BeginUpdate();
Schedule1->Calendar->set_Selection(TVariant(TDateTime(2012,5,24).operator double()));
Exschedulelib_tlb::IEventsPtr var_Events = Schedule1->Events;
var_Events->Add(TVariant(TDateTime(2012,5,24,10,00,00,0).operator double()),TVariant(TDateTime(2012,5,24,12,00,00,0).operator double()));
var_Events->Add(TVariant(TDateTime(2012,5,24,10,45,00,0).operator double()),TVariant(TDateTime(2012,5,24,12,30,00,0).operator double()));
var_Events->Add(TVariant(TDateTime(2012,5,24,11,30,00,0).operator double()),TVariant(TDateTime(2012,5,24,13,30,00,0).operator double()));
Schedule1->EndUpdate();
C#
exschedule1.BeginUpdate();
exschedule1.Calendar.Selection = Convert.ToDateTime("5/24/2012",System.Globalization.CultureInfo.GetCultureInfo("en-US"));
exontrol.EXSCHEDULELib.Events var_Events = exschedule1.Events;
var_Events.Add(Convert.ToDateTime("5/24/2012 10:00:00 AM",System.Globalization.CultureInfo.GetCultureInfo("en-US")),Convert.ToDateTime("5/24/2012 12:00:00 PM",System.Globalization.CultureInfo.GetCultureInfo("en-US")));
var_Events.Add(Convert.ToDateTime("5/24/2012 10:45:00 AM",System.Globalization.CultureInfo.GetCultureInfo("en-US")),Convert.ToDateTime("5/24/2012 12:30:00 PM",System.Globalization.CultureInfo.GetCultureInfo("en-US")));
var_Events.Add(Convert.ToDateTime("5/24/2012 11:30:00 AM",System.Globalization.CultureInfo.GetCultureInfo("en-US")),Convert.ToDateTime("5/24/2012 1:30:00 PM",System.Globalization.CultureInfo.GetCultureInfo("en-US")));
exschedule1.EndUpdate();
JavaScript
<OBJECT classid="clsid:9B09E13D-7A88-4299-9DBE-383380435377" id="Schedule1"></OBJECT>
<SCRIPT LANGUAGE="JScript">
Schedule1.BeginUpdate();
Schedule1.Calendar.Selection = "5/24/2012";
var var_Events = Schedule1.Events;
var_Events.Add("5/24/2012 10:00:00 AM","5/24/2012 12:00:00 PM");
var_Events.Add("5/24/2012 10:45:00 AM","5/24/2012 12:30:00 PM");
var_Events.Add("5/24/2012 11:30:00 AM","5/24/2012 1:30:00 PM");
Schedule1.EndUpdate();
</SCRIPT>
C# for /COM
axSchedule1.BeginUpdate();
axSchedule1.Calendar.Selection = Convert.ToDateTime("5/24/2012",System.Globalization.CultureInfo.GetCultureInfo("en-US"));
EXSCHEDULELib.Events var_Events = axSchedule1.Events;
var_Events.Add(Convert.ToDateTime("5/24/2012 10:00:00 AM",System.Globalization.CultureInfo.GetCultureInfo("en-US")),Convert.ToDateTime("5/24/2012 12:00:00 PM",System.Globalization.CultureInfo.GetCultureInfo("en-US")));
var_Events.Add(Convert.ToDateTime("5/24/2012 10:45:00 AM",System.Globalization.CultureInfo.GetCultureInfo("en-US")),Convert.ToDateTime("5/24/2012 12:30:00 PM",System.Globalization.CultureInfo.GetCultureInfo("en-US")));
var_Events.Add(Convert.ToDateTime("5/24/2012 11:30:00 AM",System.Globalization.CultureInfo.GetCultureInfo("en-US")),Convert.ToDateTime("5/24/2012 1:30:00 PM",System.Globalization.CultureInfo.GetCultureInfo("en-US")));
axSchedule1.EndUpdate();
X++ (Dynamics Ax 2009)
public void init()
{
COM com_Events;
anytype var_Events;
;
super();
exschedule1.BeginUpdate();
exschedule1.Calendar().Selection(COMVariant::createFromDate(str2Date("5/24/2012",213)));
var_Events = exschedule1.Events(); com_Events = var_Events;
com_Events.Add(COMVariant::createFromUtcDateTime(str2Datetime("5/24/2012 10:00:00",213)),COMVariant::createFromUtcDateTime(str2Datetime("5/24/2012 12:00:00",213)));
com_Events.Add(COMVariant::createFromUtcDateTime(str2Datetime("5/24/2012 10:45:00",213)),COMVariant::createFromUtcDateTime(str2Datetime("5/24/2012 12:30:00",213)));
com_Events.Add(COMVariant::createFromUtcDateTime(str2Datetime("5/24/2012 11:30:00",213)),COMVariant::createFromUtcDateTime(str2Datetime("5/24/2012 13:30:00",213)));
exschedule1.EndUpdate();
}
Delphi 8 (.NET only)
with AxSchedule1 do
begin
BeginUpdate();
Calendar.Selection := '5/24/2012';
with Events do
begin
Add('5/24/2012 10:00:00 AM','5/24/2012 12:00:00 PM');
Add('5/24/2012 10:45:00 AM','5/24/2012 12:30:00 PM');
Add('5/24/2012 11:30:00 AM','5/24/2012 1:30:00 PM');
end;
EndUpdate();
end
Delphi (standard)
with Schedule1 do
begin
BeginUpdate();
Calendar.Selection := '5/24/2012';
with Events do
begin
Add('5/24/2012 10:00:00 AM','5/24/2012 12:00:00 PM');
Add('5/24/2012 10:45:00 AM','5/24/2012 12:30:00 PM');
Add('5/24/2012 11:30:00 AM','5/24/2012 1:30:00 PM');
end;
EndUpdate();
end
VFP
with thisform.Schedule1
.BeginUpdate
.Calendar.Selection = {^2012-5-24}
with .Events
.Add({^2012-5-24 10:00:00},{^2012-5-24 12:00:00})
.Add({^2012-5-24 10:45:00},{^2012-5-24 12:30:00})
.Add({^2012-5-24 11:30:00},{^2012-5-24 13:30:00})
endwith
.EndUpdate
endwith
dBASE Plus
local oSchedule,var_Events
oSchedule = form.Activex1.nativeObject
oSchedule.BeginUpdate()
oSchedule.Calendar.Selection = "05/24/2012"
var_Events = oSchedule.Events
var_Events.Add("05/24/2012 10:00:00","05/24/2012 12:00:00")
var_Events.Add("05/24/2012 10:45:00","05/24/2012 12:30:00")
var_Events.Add("05/24/2012 11:30:00","05/24/2012 13:30:00")
oSchedule.EndUpdate()
XBasic (Alpha Five)
Dim oSchedule as P
Dim var_Events as P
oSchedule = topparent:CONTROL_ACTIVEX1.activex
oSchedule.BeginUpdate()
oSchedule.Calendar.Selection = {05/24/2012}
var_Events = oSchedule.Events
var_Events.Add({05/24/2012 10:00:00},{05/24/2012 12:00:00})
var_Events.Add({05/24/2012 10:45:00},{05/24/2012 12:30:00})
var_Events.Add({05/24/2012 11:30:00},{05/24/2012 13:30:00})
oSchedule.EndUpdate()
Visual Objects
local var_Events as IEvents
oDCOCX_Exontrol1:BeginUpdate()
oDCOCX_Exontrol1:Calendar:Selection := SToD("20120524")
var_Events := oDCOCX_Exontrol1:Events
var_Events:Add(SToD("20120524 10:00:00"),SToD("20120524 12:00:00"))
var_Events:Add(SToD("20120524 10:45:00"),SToD("20120524 12:30:00"))
var_Events:Add(SToD("20120524 11:30:00"),SToD("20120524 13:30:00"))
oDCOCX_Exontrol1:EndUpdate()
PowerBuilder
OleObject oSchedule,var_Events
oSchedule = ole_1.Object
oSchedule.BeginUpdate()
oSchedule.Calendar.Selection = 2012-05-24
var_Events = oSchedule.Events
var_Events.Add(DateTime(2012-05-24,10:00:00),DateTime(2012-05-24,12:00:00))
var_Events.Add(DateTime(2012-05-24,10:45:00),DateTime(2012-05-24,12:30:00))
var_Events.Add(DateTime(2012-05-24,11:30:00),DateTime(2012-05-24,13:30:00))
oSchedule.EndUpdate()
Visual DataFlex
Procedure OnCreate
Forward Send OnCreate
Send ComBeginUpdate
Variant voCalendar
Get ComCalendar to voCalendar
Handle hoCalendar
Get Create (RefClass(cComCalendar)) to hoCalendar
Set pvComObject of hoCalendar to voCalendar
Set ComSelection of hoCalendar to "5/24/2012"
Send Destroy to hoCalendar
Variant voEvents
Get ComEvents to voEvents
Handle hoEvents
Get Create (RefClass(cComEvents)) to hoEvents
Set pvComObject of hoEvents to voEvents
Get ComAdd of hoEvents "5/24/2012 10:00:00 AM" "5/24/2012 12:00:00 PM" to Nothing
Get ComAdd of hoEvents "5/24/2012 10:45:00 AM" "5/24/2012 12:30:00 PM" to Nothing
Get ComAdd of hoEvents "5/24/2012 11:30:00 AM" "5/24/2012 1:30:00 PM" to Nothing
Send Destroy to hoEvents
Send ComEndUpdate
End_Procedure
XBase++
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oEvents
LOCAL oSchedule
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oSchedule := XbpActiveXControl():new( oForm:drawingArea )
oSchedule:CLSID := "Exontrol.Schedule.1" /*{9B09E13D-7A88-4299-9DBE-383380435377}*/
oSchedule:create(,, {10,60},{610,370} )
oSchedule:BeginUpdate()
oSchedule:Calendar():Selection := "05/24/2012"
oEvents := oSchedule:Events()
oEvents:Add("05/24/2012 10:00:00","05/24/2012 12:00:00")
oEvents:Add("05/24/2012 10:45:00","05/24/2012 12:30:00")
oEvents:Add("05/24/2012 11:30:00","05/24/2012 13:30:00")
oSchedule:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN