PowerPoint: WindowBeforeDoubleclick event not firing in Normal View
-
Monday, December 03, 2012 7:52 AMModerator
The Powerpoint Application object has a WindowBeforeDoubleClick event:
http://msdn.microsoft.com/en-us/library/office/bb231081(v=office.12).aspx
According to this page, the event should fire in the normal view when double-clicking on a Shape object.
I have set up this event in a C# Add-in (VSTO), but it's not working as advertised. When I double click on a Shape in the Normal view the code I've assigned to the event does not get called. The event does trigger when I double-click in the Slide view, so I know it's not a problem in the add-in.
A search in the Internet brought up only one hit:
http://www.tech-archive.net/Archive/Office/microsoft.public.powerpoint/2007-03/msg01341.htmlThe person doesn't come right out and say so, but it appears the event was broken in version 2007 and aLSO wasn't fixed in 2010? The workaround suggested in the message will not work for my purpose...
Cindy Meister, VSTO/Word MVP, my blog
All Replies
-
Tuesday, December 04, 2012 1:49 AMModerator
Hi Cindy,
Thanks for posting in the MSDN Forum.
I will consult Microsoft's engineers for it. Let's see whether they can give some explain. There might be some time delay, appreciate for your patience.
Have a good day,
Tom
Tom Xu [MSFT]
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Edited by Tom_Xu_WXModerator Tuesday, December 04, 2012 1:57 AM
- Edited by Tom_Xu_WXModerator Tuesday, December 04, 2012 2:02 AM
-
Thursday, December 06, 2012 10:11 PM
Hi Cindy,
I was able to reproduce your results directly in PowerPoint 2007 and 2010 using VBA code and was able to verified that the issue you’re experiencing is due to a known bug that is currently under investigation. Unfortunately I do not have a timeframe on when this may be addressed.
I am sorry for the inconvenience this is causing you.
Can you explain what are you trying to accomplish and why using the selection change event is not an option?
My only other suggestion would be to implement a customized context menu as demonstrated here.
XML:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<!--WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS EXAMPLE IS -->
<!--AT YOUR OWN RISK. Microsoft provides this macro code "as is" without -->
<!--warranty of any kind, either express or implied, including but not limited -->
<!--to the implied warranties of merchantability and/or fitness for a particular purpose. -->
<contextMenus>
<contextMenu idMso="ContextMenuGraphicOleClassic">
<menu idMso="EditOleObjectMenu" getVisible="GetVisibleNative"></menu>
<menu id="OurCustomEditObject" getVisible="GetVisibleCustom" label="Object Actions">
<button id="MyButton2" label="Open" onAction="ClickOLEOpen" />
</menu>
</contextMenu>
</contextMenus>
</customUI>VBA:
Option Explicit
'WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS EXAMPLE IS
'AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of
'any kind, either express or implied, including but not limited to the implied warranties of
'merchantability and/or fitness for a particular purpose.Sub ClickOLEOpen()
MsgBox "Hello"
ActiveWindow.Selection.SlideRange.Shapes(3).OLEFormat.DoVerb (1)
End SubBest Regards,
Donald M.
Microsoft Online Community Support
--------------------------------------------------------------------------------
Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. -
Friday, December 07, 2012 12:52 PMModerator
Hi Donald
Thank you for the reply, information and concern :-)
My Add-in targets 2007 and 2010 (and 2013, although not yet thoroughly tested), so the context menu approach isn't possible (not supported by PowerPoint in 2007).
In my VSTO Add-in scenario I'm having to work-around another "dysfunctionality" in PowerPoint: it doesn't provide an idMso for the tool to draw free-hand curves (Insert/Illustrations/Shapes/Curve). With some help from the PowerPoint specialists who hang out in the "Communities" forum, I was able to work around this by calling an old CommandBarsButton ID. But that tool doesn't draw curves, it draws a series of straight lines.
The purpose of my add-in is to make it EASIER for the user to create certain types of diagrams, so I'm putting the tools used for these diagrams in a Custom Task Pane so that they're closer and so that the user doesn't continually need to navigate various Ribbon tabs. Since the whole idea is to make things EASIER, it would make no sense to tell the user he then needs to "edit points" and change each point from "corner" to "smooth". Thus, I require code to perform the task.
The next question is: how to trigger the task. Again, I don't want the user to have to perform any additional action. Drawing a freehand Shape finishes by double-clicking, so that was the obvious choice of event as a trigger. I could simply set a global variable (bool) when drawing starts, check for that value in the event, and perform the necessary action.
In the meantime (a day or so after posting), I have figured out how to solve it using WindowSelectionChange. But the required code is more complex than BeforeDoubleClick would have been because the user triggers it continually as he clicks to set the nodes...
Cindy Meister, VSTO/Word MVP, my blog
-
Tuesday, February 19, 2013 7:48 AM
Hi Cindy,
I am tryipng to achieve a similar thing. It would be of great help if you could post sample code of your workaround.
Thanks and regards,
Shwetal Mehta
-
Wednesday, February 20, 2013 8:10 AMModerator
void Application_WindowSelectionChange(PowerPoint.Selection Sel) { if (inDrawingMode && Sel.Type == PowerPoint.PpSelectionType.ppSelectionShapes) { inDrawingMode = false; PowerPoint.Shape shp = Sel.ShapeRange[1]; if (shp.Type == Office.MsoShapeType.msoFreeform) //USER HAS JUST DRAWN A FREEFORM SHAPE { for (int n = shp.Nodes.Count; n >= 1; n--) { shp.Nodes.SetEditingType(n, Office.MsoEditingType.msoEditingSmooth); shp.Nodes.SetSegmentType(n, Office.MsoSegmentType.msoSegmentCurve); } } } }Cindy Meister, VSTO/Word MVP, my blog

