Share via

Custom Task Pane - PowerPoint Window Problem

Anonymous
2015-04-16T02:15:57+00:00

Hi,

I noticed an oddity while trying to track a Custom Task Pane among Powerpoint windows in my Addin.

I built an Addin for PowerPoint and it uses Custom Task Panes, and my intention was so that every presentation window would have its own instance of the Task Pane, which is very easy to do, once Addin.CustomTaskPanes.Add allows me to associate a panel to one specific window. I tried then to make a toogle button for my Custom Task Pane, associated to its visibility. I understand that the Ribbon has a single instance at runtime, and runs in Application level, instead of Document level, hence I needed to sync the Checked property of the toogle button to the visibility of the Custom Task Pane on that window once the window became active. Ok. And this is where I noticed an oddity:

Private Sub CTPs_SyncVisibility(Pres As PowerPoint.Presentation, Wn As PowerPoint.DocumentWindow)

'This handles Globals.PPTAddIn.Application.WindowActivate

'Wn is a reference to the just activated window

For Each ctp As CustomTaskPane In Globals.PPTAddIn.CustomTaskPanes

If ctp.Window Is Wn Then

'Change the toogle button's Checked Property

End If

Next

End Sub

When multiple presentation windows are open, each with its own taskpane associated, the line > If ctp.Window Is Wn Then <will aways return true, for every taskpane, implying that every taskpane is associated to the window that became active, making it impossible to determine in which window a given taspane is.

Through some exploration I noticed a couple of things:

  1. It's not a problem with Powerpoint Windows direct comparison, once the folowing lines of code return the expected result:

'Assume here that .Windows(1) is the actual active window

Dim asw = Globals.PPTAddIn.Application.ActiveWindow Is Globals.PPTAddIn.Application.Windows(2)     '-> False

Dim asw2 = Globals.PPTAddIn.Application.ActiveWindow Is Globals.PPTAddIn.Application.Windows(1)     '-> True

Dim asw3 = Globals.PPTAddIn.Application.Windows(1) Is Globals.PPTAddIn.Application.Windows(2)      '-> False

  1. It doesn't seem to be a problem related to the property CustomTaskPane.Window once I tried to store the window reference in other property, like .Tag, during the instanciation of the Taskpanes, and it still yields the same weird result of True for every Taskpane regardless of in which window it is.

So, my questions are: Is this a well known misbehavior of the Custom Task Pane? Does this happens somehow beacuse it is a COM object (the window)? Am I plain dumb and this is not the way it's supposed to be done? And lastly, which method should I use to track down in which window is my taskpane?

I thank you in advance,

Máximo

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2015-04-17T07:15:22+00:00

    By all means post to both but as Steve says the advice from the MSFT Support engineers is not great. PowerPoint Devs tend to post and read here.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2015-04-16T21:31:01+00:00

    Thanks for your answer,

    I did look over at Technet to see where my question would best fit, but it seems to me that every forum over there is centered around IT issues, not developers. In Office's section of the forums, in fact, I couldn't find a single question about Addins that had a similar problem to mine. Are you positive there is where I should post my question? It seems to me I would receive yet again another answer redirecting me to some other place.

    I will post my question there, nevertheless.

    Was this answer helpful?

    0 comments No comments
  3. Steve Rindsberg 99,166 Reputation points MVP Volunteer Moderator
    2015-04-16T17:50:43+00:00

    >> The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Right.  So that's why sending people to TechNet for PPT questions is generally a BAD idea.

    We've asked you to stop doing this any number of times.  Please be reasonable.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2015-04-16T15:27:31+00:00

    Hello Máximo,

    Welcome to Microsoft Community.

    As you have created the PowerPoint Add-in with VBA/Macro, your query would be best addressed on the Office IT Pro forum. We request you to post your query on the Office IT Pro forum from the following link for assistance on the issue.

    https://social.technet.microsoft.com/Forums/office/en-US/home?forum=officeitproprevious&filter=alltypes&sort=lastpostdesc

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Let us know if you need any other information or assistance.

    Thank you.

    Was this answer helpful?

    0 comments No comments