Print Page | Close Window

Right-click select event

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=3354
Printed Date: 17 May 2024 at 7:03am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Right-click select event
Posted By: dajv
Subject: Right-click select event
Date Posted: 05 December 2005 at 10:00pm
How do I make it so that when you right-click on an event that event is selected? I want to show a popup menu after the event is selected with a right-click. Is there any reason to use the ContextMenu event over the mousedown/mouseup events to show a popup menu?

Thanks



Replies:
Posted By: sserge
Date Posted: 06 December 2005 at 11:50am
Hi,

To determine an event under the mouse cursor you can use method HitTest(). For example see Calendar VB sample, CalendarControl_ContextMenu handler.

You can use MouseUp event as well as ContextMenu.

--
WBR,
Serge


Posted By: sserge
Date Posted: 06 December 2005 at 11:51am
btw, you can also do any kind of selection inside those methods.


Posted By: dajv
Date Posted: 06 December 2005 at 5:47pm
This is what I was already doing, but I thought I was oing it wrong because there is a problem. On the mousedown event I have:

xtmCalendar.ActiveView.UnselectAllEvents ' without this the event will never be selected, subsequent right clicks or not.
Set HitTest = xtmCalendar.ActiveView.HitTest
If Not HitTest.ViewEvent Is Nothing Then
    xtmCalendar.ActiveView.SelectViewEve nt HitTest.ViewEvent, True
End If

And I show the popup menu on mouseup.

The problem is that the event is not selected until the second time I right-click on the event. The first time I right click on the event (when it hasnt been selected), the event is not visibly selected on mouse down, and on mouse up it doesn't show either (the popup does show though). The only time it shows is when next I right click on the event (not having clicked anywhere else), and then it does work correctly - the event is selected on mouse down, and the popup is shown on mouse up.

What appears to be happening though is that its not exactly the second time I right click - it is the next time I right click ONE SECOND after the first right click. So I can right click as many times as I like, the selection will only happen 1 second after the first right click (e.g. say i keep right clicking many times, the selection will only happen on the first click that occurs one full second after the initial right click).

Here is a sample that reproduces it: uploads/dajv/2005-12-06_174649_xcb_calendar_bug_2.rar - 2005-12-06_174649_xcb_calendar_bug_2.rar


Posted By: sserge
Date Posted: 07 December 2005 at 2:40pm
Please note that some simple Calendar operations like SelectViewEvent does not redraw a control's window in order to avoid blinking when executed in groups (like selecting a number of events).

So, just call xtmCalendar.RedrawControl after changing a selection (at the end of this method).

--
HTH,
Serge


Posted By: dajv
Date Posted: 07 December 2005 at 3:02pm
That would have been useful to know before and would have saved alot of time.

Thanks.


Posted By: sserge
Date Posted: 07 December 2005 at 3:41pm
Really sorry. Will add that into the proper places of the documentation for future.

--
WBR,
Serge


Posted By: dajv
Date Posted: 07 December 2005 at 3:43pm
Its no worries mate. That would be a great addition to the documentation.



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