Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Use the HitTest to determine the resource clicked
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Use the HitTest to determine the resource clicked

 Post Reply Post Reply
Author
Message
RedFin View Drop Down
Groupie
Groupie
Avatar

Joined: 26 March 2008
Location: Australia
Status: Offline
Points: 47
Post Options Post Options   Thanks (0) Thanks(0)   Quote RedFin Quote  Post ReplyReply Direct Link To This Post Topic: Use the HitTest to determine the resource clicked
    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

Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
RedFin View Drop Down
Groupie
Groupie
Avatar

Joined: 26 March 2008
Location: Australia
Status: Offline
Points: 47
Post Options Post Options   Thanks (0) Thanks(0)   Quote RedFin Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
RedFin View Drop Down
Groupie
Groupie
Avatar

Joined: 26 March 2008
Location: Australia
Status: Offline
Points: 47
Post Options Post Options   Thanks (0) Thanks(0)   Quote RedFin Quote  Post ReplyReply Direct Link To This Post Posted: 19 April 2011 at 5:41am

Thanks heaps Xander, that's perfect :)

Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post 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)
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.145 seconds.