Right-click select event |
Post Reply |
Author | |
dajv
Groupie Joined: 27 July 2004 Location: Australia Status: Offline Points: 80 |
Post Options
Thanks(0)
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 |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
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 |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
btw, you can also do any kind of selection inside those methods.
|
|
dajv
Groupie Joined: 27 July 2004 Location: Australia Status: Offline Points: 80 |
Post Options
Thanks(0)
|
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: 2005-12-06_174649_xcb_calendar_bug_2.rar |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
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 |
|
dajv
Groupie Joined: 27 July 2004 Location: Australia Status: Offline Points: 80 |
Post Options
Thanks(0)
|
That would have been useful to know before and would have saved alot of time.
Thanks. |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Really sorry. Will add that into the proper places of the documentation for future.
-- WBR, Serge |
|
dajv
Groupie Joined: 27 July 2004 Location: Australia Status: Offline Points: 80 |
Post Options
Thanks(0)
|
Its no worries mate. That would be a great addition to the documentation.
|
|
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 |