none
How to disable PowerPoint's default action on double click and right click events? RRS feed

  • Question

  • Hello,
    I am creating a PowerPoint Add-in using Visual Studio Tools for Office in C#.
    Since in presentation edit mode, PowerPoint's WindowBeforeRightClick and WindowBeforeDoubleClick don't get fired, so I am creating an application-level MouseHook that captures the mouse movements and click events.
    I need to display custom menus when user right or double clicks in edit presentation mode.

    My code looks like this

    MyMouseHookListener.MouseDoubleClick += MyMouseHookListener_MouseDoubleClick;
    
    //Event body for MouseDoubleClick
    
    void MyMouseHookListener_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e)
    {
        if (e.X > myShape.x1 && e.X < myShape.x2 && e.Y > myShape.y1 && e.Y < myShape.y2)
        {
             MyMenuForm.ShowDialog();
        }
    }
    This displays my custom menu but when the user closes this menu the default action of PowerPoint of double click on a shape appears on the screen. How can I disable this action?
    In WindowBeforeDoubleClick event of PowerPoint.Application has a bool Cancel property that when set to true disables the default action to be performed when the event is fired. Can I access this property in my DoubleClick event? If yes, then how?

    Thanks.



    Tuesday, May 6, 2014 7:20 AM

Answers

  • Hi,

    >> Since in presentation edit mode, PowerPoint's WindowBeforeRightClick and WindowBeforeDoubleClick don't get fired,

    What does the “edit mode” mean? Does it represent the Normal View in PowerPoint?

    Actually, these events can be fired when I handle these event in my add-in.

    >> Can I access this property in my DoubleClick event? If yes, then how?

    I’m afraid there isn't any property to disable the default mouse click event in PowerPoint.

    The mouse hooker can’t prevent the mouse event to open default context menu from appearing.

    Regards,

    Marvin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Marvin_Guo Monday, May 12, 2014 9:42 AM
    • Marked as answer by Marvin_Guo Friday, May 16, 2014 7:57 AM
    Thursday, May 8, 2014 6:24 AM