Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - managed C++ & Active-X calendar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

managed C++ & Active-X calendar

 Post Reply Post Reply
Author
Message
hicus View Drop Down
Newbie
Newbie


Joined: 02 October 2006
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote hicus Quote  Post ReplyReply Direct Link To This Post Topic: managed C++ & Active-X calendar
    Posted: 02 October 2006 at 3:39pm
Is it possible to use Xtreme CalendarPro Active-X control with mannaged C++?
Is there any example code of adding calendar events written in C++ concerning Xtreme CalendarPro Active-X control?


Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 02 October 2006 at 3:54pm
Hi,

Yes, that's possible. There are no specific examples, but it will be quite similar to out C# Calendar sample application. You can look at it and compare...

--
WBR,
Serge
Back to Top
hicus View Drop Down
Newbie
Newbie


Joined: 02 October 2006
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote hicus Quote  Post ReplyReply Direct Link To This Post Posted: 05 October 2006 at 12:52pm
Here is Form1.h file that demonstrates use of ActiveX calendar with managed C++. Project name is "klinika". Just 1 form and 1 "CalendarControl":


/////////////////////////

#pragma once


namespace kalendar
{
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::Globalization;

    using namespace System::IO;


    /// <summary>
    /// Summary for Form1
    ///
    /// WARNING: If you change the name of this class, you will need to change the
    ///          'Resource File Name' property for the managed resource compiler tool
    ///          associated with all .resx files this class depends on.  Otherwise,
    ///          the designers will not be able to interact properly with localized
    ///          resources associated with this form.
    /// </summary>
public __gc class Form1 : public System::Windows::Forms::Form
{   
public:
    Form1(void)
    {
        InitializeComponent();
        //src/dst for CalendarControl events -> set it on .xml file:
        ConnectionString = String::Concat("Provider=XML;Data Source=" , System::Environment::CurrentDirectory->ToString(), "\\.." );
        CalendarControl->SetDataProvider(String::Concat(ConnectionString,"\\CalendarData.xml"));
        pCalendarData = CalendarControl->DataProvider;

        //if file (xml) exists => open it for use; else create new one:
        if (!File::Exists(String::Concat(System::Environment::CurrentDirectory->ToString(),"\\..\\CalendarData.xml")) )
        {
            //ujedno kreira i otvara za rad fajl CalendarData.xml:
            pCalendarData->Create();
        }
        else
        {
            pCalendarData->Open();
        }

        CalendarControl->Populate();
    }

protected:
    void Dispose(Boolean disposing)
    {
        if (disposing && components)
        {
            components->Dispose();
        }
        __super::Dispose(disposing);
    }
// calendar variables:
private: Interop::XtremeCalendarControl::CalendarEvent* ptrEvent;
private: Interop::XtremeCalendarControl::CalendarDataProvider* pCalendarData;
private: AxInterop::XtremeCalendarControl::AxCalendarControl *  CalendarControl;


         //Sting used to hold path to save xml data files. 
         //This file will contain all of the event information displayed in the calendar view:
public: String* ConnectionString;

private:
    /// <summary>
    /// Required designer variable.
    /// </summary>
    System::ComponentModel::Container * components;

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    void InitializeComponent(void)
    {
        System::Resources::ResourceManager *  resources = new System::Resources::ResourceManager(__typeof(kalendar::Form1));
        this->CalendarControl = new AxInterop::XtremeCalendarControl::AxCalendarControl();
        (__try_cast<System::ComponentModel::ISupportInitialize *  >(this->CalendarControl))->BeginInit();
        this->SuspendLayout();
        //
        // CalendarControl
        //
        this->CalendarControl->Dock = System::Windows::Forms::DockStyle::Fill;
        this->CalendarControl->Location = System::Drawing::Point(0, 0);
        this->CalendarControl->Name = S"CalendarControl";
        this->CalendarControl->OcxState = (__try_cast<System::Windows::Forms::AxHost::State *  >(resources->GetObject(S"CalendarControl.OcxState")));
        this->CalendarControl->Size = System::Drawing::Size(800, 510);
        this->CalendarControl->TabIndex = 0;
        this->CalendarControl->EventChanged += new AxInterop::XtremeCalendarControl::_DCalendarControlEvents_EventChangedEventHandler(this, CalendarControl_EventChanged);
        this->CalendarControl->EventAdded += new AxInterop::XtremeCalendarControl::_DCalendarControlEvents_EventAddedEventHandler(this, CalendarControl_EventAdded);
        //
        // Form1
        //
        this->AutoScaleBaseSize = System::Drawing::Size(5, 13);
        this->ClientSize = System::Drawing::Size(800, 510);
        this->Controls->Add(this->CalendarControl);
        this->Name = S"Form1";
        this->Text = S"Form1";
        (__try_cast<System::ComponentModel::ISupportInitialize *  >(this->CalendarControl))->EndInit();
        this->ResumeLayout(false);

    }   

    //////////////////////////////////////////////////////////////////////////////
    //



         ////////////////////////////////////////////////////////////////////
         // You can call this function in constructor for test...
private: void AddTestEvents()
         {

             // add test events
             DateTime dtNow = DateTime(DateTime::Now.Ticks);

             // Create 1 normal event:

             // Normal Event 1
             Interop::XtremeCalendarControl::CalendarEvent* ptrEvent = pCalendarData->CreateEvent();
             ptrEvent->StartTime = dtNow;
             ptrEvent->EndTime = dtNow.AddHours(1);
             ptrEvent->Subject = "Event &Now [Tentative Meeting]";
             ptrEvent->Location = "MSB - Room 204";
             //ptrEvent->SetReminderMinutesBeforeStart(10);
             ptrEvent->BusyStatus = Interop::XtremeCalendarControl::CalendarEventBusyStatus::xtpCalendarBusyStatusTentative;
             ptrEvent->MeetingFlag = true;
             pCalendarData->AddEvent(ptrEvent);


             //Saves events to .xml file:
             pCalendarData->Save();
             CalendarControl->Populate();
         }
         //
         ///////////////////////////////////////////////////////////


private: System::Void CalendarControl_EventChanged(System::Object *  sender, AxInterop::XtremeCalendarControl::_DCalendarControlEvents_EventChangedEvent *  e)
         {
             pCalendarData->Save();
         }

private: System::Void CalendarControl_EventAdded(System::Object *  sender, AxInterop::XtremeCalendarControl::_DCalendarControlEvents_EventAddedEvent *  e)
         {
             //Saves events to TestEvents.xml file
              pCalendarData->Save();
         }

};
}
/////////////////////////////////////////////////////////////
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.187 seconds.