AddInExpress equivalent of Globals.Ribbons()

Add-in Express™ Support Service
That's what is more important than anything else

AddInExpress equivalent of Globals.Ribbons()
 
Leonardo Silvestri Suarez




Posts: 5
Joined: 2012-02-20
Hi, Is there something equivalent to Globals.Ribbons() in AddinExpress?

Thanks much
Leonardo
Posted 03 Aug, 2013 10:39:31 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello leonardo,

Add-in Express provides a different approach to Ribbons so there's no unambiguous equivalent to Globals.Ribbons.

1. To modify the state of a control just call the appropriate method of the corresponding component:

AdxRibbonButton1.Enable = False


2. To retrieve the IRibbonUI object, you need to intercept the OnRibbonLoaded event of the add-in module.

If the above doesn't help, please desribe your goals, and I'll do my best to help you.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 05 Aug, 2013 03:10:54 Top
Leonardo Silvestri Suarez




Posts: 5
Joined: 2012-02-20
Hi Andrei, thanks for your response.

I have an addin for Outlook,Word and Excel.

What I need is to get all the instances of a Button (in a Ribbon and in a command bar) to enable or disable it.
For example a login/logout button. If I logout I want to disable (all instances) of some buttons.

It was implemented before with VSTO using Globals.Ribbons() and I'm migrating it.
Posted 05 Aug, 2013 07:13:45 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Leonardo,

I see.

Then you need to modify the Enabled property of the corresponding ADXRibbonButton component.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 05 Aug, 2013 07:22:41 Top
Leonardo Silvestri Suarez




Posts: 5
Joined: 2012-02-20
Yes Andrei, that's what I need
Posted 05 Aug, 2013 07:27:46 Top
Leonardo Silvestri Suarez




Posts: 5
Joined: 2012-02-20
But I need to do it in all the instances of that button. Same Ribbon is displayed in Outlook/Word/Excel, if I logout from one I need to disable buttons from every application opened.

Let me know if that is clear.
Posted 05 Aug, 2013 07:39:26 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Every button instance (displayed in Word, Excel and Outlook) is created by a separate instance of your add-in. You can directly disable the ribbon button shown in the current host application (say, Word). To hide the button instances in another host application (say, Excel), you access your COM add-in via the following code path:

ExcelApp.COMAddins.Item(strMyComAddinProgId).Object.MyPublicMethod.

1. strMyComAddinProgId - see the ProgId attribute of your add-in module.
2. MyPublicPropertyOrMethod is called via late binding (see System.Type.InvokeMember in MSDN or search through our forums)

Since the code line above is executed in the instance of your add-in loaded in Word, you'll need to get an Excel.Application object, you do this via Marshal.GetActiveObject("Excel.Application"). In the add-in instance loaded in Excel, the code of MyPublicMethod hides/disables the button in question.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 05 Aug, 2013 08:03:13 Top