Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - right click on month view
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

right click on month view

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


Joined: 28 March 2007
Location: United Kingdom
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote tejsingh Quote  Post ReplyReply Direct Link To This Post Topic: right click on month view
    Posted: 12 April 2007 at 7:00am
Hi

I want to add an event when right clicking on a month view.

I currently have it working for right click events. But want it so that if in the month view i right click i it to fire the event and pass the dates through to my progress 4gl.

Looked at samples but they didnt help

It is it to do with hittest?

i have added the current code below:

Private Sub Calendar_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    Dim hHit As CalendarHitTestInfo
    Dim StartDate As Date
    Dim EndDate As Date
    Dim cName As String
    'Dim Popup As CommandBar
       
    If Button = 2 Then
        Select Case Calendar.ViewType
            Case xtpCalendarDayView, xtpCalendarWorkWeekView
                Set hHit = Calendar.DayView.HitTest
            Case xtpCalendarWeekView
                Set hHit = Calendar.WeekView.HitTest
            Case xtpCalendarMonthView
                Set hHit = Calendar.MonthView.HitTest
        End Select
       
     '   Set Popup = CommandBars.Add("Popup", xtpBarPopup)
      '               With Popup.Controls
       '                  .Add xtpControlButton, ID_NEW_APPOINTMENT, "Add New Appointment"
        '                 .Add xtpControlButton, ID_ALL_DAY_EVENT, "Add All Day Event"
         '                .Add xtpControlButton, ID_ADD_MEETING, "Add Meeting Request"
          '          End With
           '     Popup.ShowPopup
       
        If Not hHit Is Nothing Then
            If Not hHit.ViewEvent Is Nothing Then
                RaiseEvent EventRClick(hHit.ViewEvent.Event)
            Else
                Select Case Calendar.ViewType
                    Case xtpCalendarDayView, xtpCalendarWorkWeekView
                        StartDate = Calendar.DayView.Selection.Begin
                        EndDate = Calendar.DayView.Selection.End
                    Case xtpCalendarWeekView
                        StartDate = Calendar.DayView.Selection.Begin
                        EndDate = Calendar.DayView.Selection.End
                    Case xtpCalendarMonthView
                        StartDate = Calendar.DayView.Selection.Begin
                        EndDate = Calendar.DayView.Selection.End
                End Select
                If Not hHit.ViewGroup Is Nothing Then
                    cName = hHit.ViewGroup.MultipleResources.Item(0).Name
                End If
                If hHit.HitDateTime >= StartDate And hHit.HitDateTime <= EndDate Then
                    RaiseEvent RClick(StartDate, EndDate, cName)
                End If
            End If
        End If
    End If
       
End Sub

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

Joined: 09 June 2006
Status: Offline
Points: 273
Post Options Post Options   Thanks (0) Thanks(0)   Quote joeliner Quote  Post ReplyReply Direct Link To This Post Posted: 12 April 2007 at 7:28am
Try use the contextMenu Event rather.

It works well. See the calendar sample.
Product: Xtreme SuitePro (ActiveX) version 13.1
Platform: Windows XP SP 3
Language: Visual Basic 6 SP6
Back to Top
joeliner View Drop Down
Senior Member
Senior Member
Avatar

Joined: 09 June 2006
Status: Offline
Points: 273
Post Options Post Options   Thanks (0) Thanks(0)   Quote joeliner Quote  Post ReplyReply Direct Link To This Post Posted: 12 April 2007 at 7:42am

Private Sub CalendarControl_ContextMenu(ByVal X As Single, ByVal Y As Single)

    Debug.Print "On context menu"
    
    Dim HitTest As CalendarHitTestInfo
    Set HitTest = CalendarControl.ActiveView.HitTest
   
    If Not HitTest.ViewEvent Is Nothing Then
        Set ContextEvent = HitTest.ViewEvent.Event
        '
        '
        'code for event popup goes here
        '
        Set ContextEvent = Nothing
     Else
          '
        '
        'code for calendar popup goes here
        '
    End If

End Sub
 
Back to Top
tejsingh View Drop Down
Newbie
Newbie


Joined: 28 March 2007
Location: United Kingdom
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote tejsingh Quote  Post ReplyReply Direct Link To This Post Posted: 12 April 2007 at 9:22am
ok cool will give that a go!
Back to Top
tejsingh View Drop Down
Newbie
Newbie


Joined: 28 March 2007
Location: United Kingdom
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote tejsingh Quote  Post ReplyReply Direct Link To This Post Posted: 12 April 2007 at 9:53am
Ok

I have added the code in but still no joy.

I have created a menu similar to the calendar sample.

When i run the calendar Active-X control from VB it opens it in Internet explorer.

The code is exactly the same! but when i right click nothing happens!

I even created the ocx and ran it in Progress 4gl but that still didnt work.

any ideas?

Private Sub CalendarControl_ContextMenu(ByVal X As Single, ByVal Y As Single)

    Dim HitTest As CalendarHitTestInfo
    Set HitTest = CalendarControl.ActiveView.HitTest
  
    If Not HitTest.ViewEvent Is Nothing Then
        Set ContextEvent = HitTest.ViewEvent.Event
                '
        '
        'code for event popup goes here
        '
        Set ContextEvent = Nothing
     Else
        PopupMenu ContextNew
    End If

End Sub
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.141 seconds.