Print Page | Close Window

right click on month view

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=6845
Printed Date: 06 October 2024 at 1:02pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: right click on month view
Posted By: tejsingh
Subject: right click on month view
Date 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




Replies:
Posted By: joeliner
Date 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


Posted By: joeliner
Date 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
 


Posted By: tejsingh
Date Posted: 12 April 2007 at 9:22am
ok cool will give that a go!


Posted By: tejsingh
Date 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



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