How do I dynamically alter Powerpoint 2013 backstage controls from an addin

OK, I have had a lot of help changing the visibility of a backstage control in Powerpoint 2013.
This is great for a static change, but now I need to change the visibility depending on some state in my addin (C# based).
I have the code below,  but the SaveAsEnabled function never gets called (I have place breakpoint to check this) .  Any ideas ? Is my prototype correct?

MS Powerpoint 2013
Visual Studio 2012 ultimate

MyRibbon.xml
<backstage>
    <tab idMso="TabSave" getVisible="SaveAsEnabled"/>
</backstage>

MyRibbon.cs
private bool saveAsEnabled;

bool SaveAsEnabled (object Obj)
{
    return saveAsEnabled;
}

Open in new window


many thanks
Tony
Winterfell63Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jamie GarrochPowerPoint Consultant & DeveloperCommented:
I have used this callback successfully in the backstage but only in a VBA application add-in. But on checking the callback signature for C# I found this for the signature:

bool GetVisible(IRibbonControl control)

Open in new window


Not sure if the declaration of Obj should work too. I would also add a debug message in addition to a breakpoint as I've had a lot of problems breaking in ribbon callback procedures, again, in albeit in VBA.
0
Winterfell63Author Commented:
Thanks Jamie, I will give it a try when I get back and keep you posted.
Incidentally, where did you find the info for the callback signature?
0
Jamie GarrochPowerPoint Consultant & DeveloperCommented:
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Winterfell63Author Commented:
Hi Jamie,
sadly this signature made no difference.  
The breakpoint not being hit, there is no debug output and the (temporarily hard-coded) return value of  false is not being used. i.e the save-as control is still visible.
0
Winterfell63Author Commented:
ahh - I think this is by design (grrrrr)
Interesting to note that you seem to be able to do it with vba, but when I enable show addin errors (something I didn't know existed until this evening)  I get the following dialog :

Line 34:
Column: 54
Error Code 0x800004005
Callback functions cannot be specified on built-in controls. Control ID: "TabSave"


Any ideas for a work around?
0
Jamie GarrochPowerPoint Consultant & DeveloperCommented:
Sorry, you're right. I checked the project I was referring to and the backstage buttons/tabs were permanently disabled by XML and not dynamically via callbacks. Why not turn the built in built in control off and then create your own Save button that can be controlled with callbacks?
0
Winterfell63Author Commented:
Hi Jamie
I think that is the route I am going to have to go down, it would be really useful if I could reuse the "Save as" tab though; is this possible, so that I have my own "save as" button control with visibility controlled via callbacks opening the standard "Save As" tab? or do I, somehow, have to recreate the whole thing (could be a look and feel nightmare?)
0
Jamie GarrochPowerPoint Consultant & DeveloperCommented:
AFAIK, you can't reuse the Save As tab if you want to dynamically control it in any way. I am totally with you on the look & feel challenge. I often find myself asking the question when developing with MSO apps "why does it feel like I'm reinventing the wheel?"!!! Sorry I couldn't find a solution for you.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Winterfell63Author Commented:
No problems Jamie, thanks for trying but I guess we are up against  some strange decision-making on the part of MSO team.  
Unless there is some strange inter-dependancy on the built-in controls and the underlying model (which would be odd development practice at the best of times), I can't for the life of me think why the ability to dynamically switch the visibility of the built-in controls is denied us.  Ho Hum

Thanks once again for trying.

Tony
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft PowerPoint

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.