right click on month view |
Post Reply |
Author | |
tejsingh
Newbie Joined: 28 March 2007 Location: United Kingdom Status: Offline Points: 25 |
Post Options
Thanks(0)
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 |
|
joeliner
Senior Member Joined: 09 June 2006 Status: Offline Points: 273 |
Post Options
Thanks(0)
|
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 |
|
joeliner
Senior Member Joined: 09 June 2006 Status: Offline Points: 273 |
Post Options
Thanks(0)
|
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 |
|
tejsingh
Newbie Joined: 28 March 2007 Location: United Kingdom Status: Offline Points: 25 |
Post Options
Thanks(0)
|
ok cool will give that a go!
|
|
tejsingh
Newbie Joined: 28 March 2007 Location: United Kingdom Status: Offline Points: 25 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |