Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Right-click select event
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Right-click select event

 Post Reply Post Reply
Author
Message
dajv View Drop Down
Groupie
Groupie


Joined: 27 July 2004
Location: Australia
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote dajv Quote  Post ReplyReply Direct Link To This Post Topic: Right-click select event
    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
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 06 December 2005 at 11:51am
btw, you can also do any kind of selection inside those methods.
Back to Top
dajv View Drop Down
Groupie
Groupie


Joined: 27 July 2004
Location: Australia
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote dajv Quote  Post ReplyReply Direct Link To This Post 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: 2005-12-06_174649_xcb_calendar_bug_2.rar
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
dajv View Drop Down
Groupie
Groupie


Joined: 27 July 2004
Location: Australia
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote dajv Quote  Post ReplyReply Direct Link To This Post Posted: 07 December 2005 at 3:02pm
That would have been useful to know before and would have saved alot of time.

Thanks.
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 07 December 2005 at 3:41pm
Really sorry. Will add that into the proper places of the documentation for future.

--
WBR,
Serge
Back to Top
dajv View Drop Down
Groupie
Groupie


Joined: 27 July 2004
Location: Australia
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote dajv Quote  Post ReplyReply Direct Link To This Post Posted: 07 December 2005 at 3:43pm
Its no worries mate. That would be a great addition to the documentation.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.