Print Page | Close Window

Use the HitTest to determine the resource clicked

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=18240
Printed Date: 15 July 2025 at 9:44pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Use the HitTest to determine the resource clicked
Posted By: RedFin
Subject: Use the HitTest to determine the resource clicked
Date Posted: 18 April 2011 at 6:22pm

Hi,

I am displaying a number of resources in my calendar.  I am using the HitTest object to ascertain the Date/Time clicked, and while I can use the HitTest object to access information about all resources, I would like to be able to find out which resource I actually clicked on.  Would anyone be able to help me with this please?


Thanks,


Rohan




Replies:
Posted By: Xander75
Date Posted: 19 April 2011 at 3:35am
Hi,

By resource do you mean the Calendar Event?

If so then the following code works for me:


    Dim cEvent As CalendarEvent
    Dim HitTest As CalendarHitTestInfo
    Set HitTest = CalendarControl.ActiveView.HitTest

    If Not HitTest.ViewEvent Is Nothing Then
        Set cEvent = HitTest.ViewEvent.Event

        ' Print some of the info for the event, there is more available within cEvent
        Debug.Print cEvent.Subject
        Debug.Print cEvent.Location
        Debug.Print cEvent.Body
        Debug.Print cEvent.StartTime
        Debug.Print cEvent.EndTime
        Debug.Print cEvent.Importance

    End If



-------------
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)


Posted By: RedFin
Date Posted: 19 April 2011 at 4:42am

Thanks Xander.  By resource I mean that each day in the calendar can have a number of resources within it - eg. Room 1, Room 2 -



When the user clicks in the calendar a custom form opens for creating a booking.  I need to be able to pass the resource that was clicked to the custom booking form.


Thanks,

Rohan



Posted By: Xander75
Date Posted: 19 April 2011 at 5:01am
Hi,

Ok I see what you mean, never used the ResourceManager before but using the VB Calendar sample I added several resources and with the following code I was able to determine which Resource was clicked on.


    Dim HitTest As CalendarHitTestInfo
    Set HitTest = CalendarControl.ActiveView.HitTest
   
    If Not HitTest.ViewGroup Is Nothing Then
        Debug.Print "Resource: " & HitTest.ViewGroup.MultipleResources.Item(0).Name
    End If




-------------
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)


Posted By: RedFin
Date Posted: 19 April 2011 at 5:41am

Thanks heaps Xander, that's perfect :)



Posted By: Xander75
Date Posted: 19 April 2011 at 5:43am
You're welcome...

Glad I could help.

-------------
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)



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