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

Right-click event to select

 Post Reply Post Reply
Author
Message
nighthawk View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 June 2004
Status: Offline
Points: 167
Post Options Post Options   Thanks (0) Thanks(0)   Quote nighthawk Quote  Post ReplyReply Direct Link To This Post Topic: Right-click event to select
    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?  
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: 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
Back to Top
nighthawk View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 June 2004
Status: Offline
Points: 167
Post Options Post Options   Thanks (0) Thanks(0)   Quote nighthawk Quote  Post ReplyReply Direct Link To This Post 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?
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: 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
Back to Top
TracyP View Drop Down
Groupie
Groupie


Joined: 16 February 2006
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote TracyP Quote  Post ReplyReply Direct Link To This Post 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.
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: 04 May 2006 at 5:54pm
Thanks, will fix that problem for a next version.

--
WBR,
Serge
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.