Right-click event to select
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=4135
Printed Date: 22 November 2024 at 4:22am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Right-click event to select
Posted By: nighthawk
Subject: Right-click event to select
Date Posted: 04 May 2006 at 12:53pm
When I right-click an event, I want the event to become selected and then I want to pop up a menu. I have no problem getting the popup menu to appear (using the MouseDown event) but how do I select the event when right-clicking it?
|
Replies:
Posted By: sserge
Date Posted: 04 May 2006 at 3:11pm
Something like following:
' Detect clicked event Dim HitTest As CalendarHitTestInfo Set HitTest = CalendarControl.ActiveView.HitTest ' ... ' Select clicked event CalendarControl.DayView.SelectViewEvent HitTest.ViewEvent, True
|
Also do not forget to redraw a control after selecting an event.
Look also at VB sample, CalendarControl_ContextMenu handler.
-- WBR, Serge
|
Posted By: nighthawk
Date Posted: 04 May 2006 at 4:06pm
Thanks Serge. That mostly works except that even if I call the RedrawControl prior to calling the popup menu, it still won't appear selected until after the popup menu goes away. For example, I modified the CalendarControl_ContextMenu in the sample program as follows:
Dim HitTest As CalendarHitTestInfo Set HitTest = CalendarControl.ActiveView.HitTest If Not HitTest.ViewEvent Is Nothing Then '***I added these two lines*** CalendarControl.DayView.SelectViewEvent HitTest.ViewEvent, True CalendarControl.RedrawControl Set ContextEvent = HitTest.ViewEvent.Event Me.PopupMenu mnuContexEditEvent Set ContextEvent = Nothing ElseIf (HitTest.HitCode = xtpCalendarHitTestDayViewTimeScale) Then Me.PopupMenu mnuContextTimeScale Else Me.PopupMenu mnuContextNewEvent End If
|
How do I make it appear selected before the popup menu is displayed?
|
Posted By: sserge
Date Posted: 04 May 2006 at 5:13pm
That's a bit strange, but as a workaround try to replace simple call .RedrawControl to:
CalendarControl.Visible = False CalendarControl.RedrawControl CalendarControl.Visible = True
|
That should help
-- WBR, Serge
|
Posted By: TracyP
Date Posted: 04 May 2006 at 5:28pm
I have the same problem with v9.81 ActiveX.
When an Event is selected, the Visible trick works. When a time is selected, it does not.
|
Posted By: sserge
Date Posted: 04 May 2006 at 5:54pm
Thanks, will fix that problem for a next version.
-- WBR, Serge
|
|