Print Page | Close Window

Event collection

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=6978
Printed Date: 04 October 2024 at 6:08am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Event collection
Posted By: Algae
Subject: Event collection
Date Posted: 25 April 2007 at 1:24pm
I created an event filtering method so I can selectively display the events I want based on the criteria I set. The objective is to remove events that have been filtered from the display (while not removing them from the database).

All works well and I have a collection of eventID's from another table that I will use to filter from. The problem I have run into is that I'm not sure where to find the event collection that the calendar is actively using. Are these loaded from the database every time they are required (such as in "Populate")?

I tried chasing the data member m_arEvents around the code but haven't found an accessor to it so I'm not sure that's what I am looking for.

So my questions are:

1. Is there a collection of events, or event pointers that identify the currently used (displayed) event objects?

2. Is there an accessor to this collection from one of the classes? If so, I could use a nudge in the right direction as to finding it.

3. If there is no collection, then is it correct to assume the best approach would be to reload all the events from the database and filter them at that time?

Thank you for any assistance that anyone can provide.



Replies:
Posted By: Algae
Date Posted: 10 May 2007 at 5:40pm
Ok.. I'm assuming no one else knows what I'm talking about or if they do it's a trade secret 

Maybe if I rephrase the question:

Is there a way to traverse an XTPCalendarView's Calendar Events?

(Other than going directly to the database and grabbing the records)


Posted By: sserge
Date Posted: 12 May 2007 at 7:38am
Hi,

Basing on a hierarchy of views and events you can iterate them in a following way. I've just tried this method:

    CString strEvents;
    CXTPCalendarView* pView = GetCalendarCtrl().GetActiveView();
    int nDays = pView->GetViewDayCount();
    for (int nDay = 0; nDay < nDays; nDay++)
    {
        CXTPCalendarViewDay* pViewDay = pView->GetViewDay_(nDay);
        int nGroupsCount = pViewDay->GetViewGroupsCount();
        for (int g = 0; g < nGroupsCount; g++)
        {
            CXTPCalendarViewGroup* pViewGroup = pViewDay->GetViewGroup_(g);
            int nECount = pViewGroup->GetViewEventsCount();
            for (int j = 0; j < nECount; j++)
            {
                CXTPCalendarViewEvent* pViewEvent = pViewGroup->GetViewEvent_(j);
                CXTPCalendarEvent* pEv = pViewEvent ? pViewEvent->GetEvent() : NULL;

                if (pEv)
                {
                    strEvents += pEv->GetSubject() + _T("\n");
                }

            }
        }

    }

    AfxMessageBox(strEvents);


--
WBR,
Serge



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net