Ribbon controls in ADXAddinAdditionalModule not displayed

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

Ribbon controls in ADXAddinAdditionalModule not displayed
 
Maros Kantera




Posts: 17
Joined: 2007-01-09
Hi,

I have separated my addin UI for office2003 and office2007 to two ADXAddinAdditionalModule-s. I assumed I could use ADXAddinAdditionalModuleItem.Enabled property to load only correct module for currently running version of office, so I have set ADXAddinAdditionalModuleItem.Enabled to false as default for both module items. Then in AddinModule_AddinInitialize I detect version of office and enable only correct module item. This works fine in office2003 but in office2007 the ribbon UI is not displayed. I think the reason is that initializing of ribbon UI preceeds AddinInitialize event. Is there any workaround to this? Setting Enabled to true as default for office 2007 module item works, but it really complicates my other requirement of disabling addin functionality if the addin can't connect to some remote server in AddinModule_AddinInitialize event. You know disabling features after they were enabled is much more cumberstone than not enabling them at all.

Just to clarify things, here is my desired pseudo code in AddinModule_AddinInitialize:

if (connect to remote server succeedeed)
{
Enable common addin functionality (shortcuts etc)

switch (office version)
{
case 2003: office2003moduleItem.Enabled = true
case 2007: office2007moduleItem.Enabled = true
}
}

Thanks
Posted 27 Feb, 2008 11:58:57 Top
Sergey Grischenko


Add-in Express team


Posts: 6903
Joined: 2004-07-05
Hi Maros.

Please use the OnRibbonBeforeCreate event handler to enable the module.
Posted 27 Feb, 2008 12:25:02 Top
Maros Kantera




Posts: 17
Joined: 2007-01-09
Thanks, that worked!
Posted 27 Feb, 2008 17:57:03 Top
Maros Kantera




Posts: 17
Joined: 2007-01-09
Hi,

as I have written before your suggestion to enable the module in OnRibbonBeforeCreate worked, but I have encountered some wierd behaviour of my office2007 specific ADXAddinAdditionalModule. In event handlers of wordEvents.DocumentBeforeClose, wordEvents.NewDocument and others I'm trying to enable/disable some ribbon controls placed in my ADXAddinAdditionalModule. I'm accessing the module through ADXAddinAdditionalModuleItem.Module property, but changes made to the ribbon controls are not reflected in UI. I've discovered that during startup of the addin, two instances of my ADXAddinAdditionalModule are created! The one I'm accessing through ADXAddinAdditionalModuleItem.Module seems not to be the right one. Could you suggest me some solution to alter my ribbon controls in additional module?

Thanks
Posted 29 Feb, 2008 04:38:36 Top
Sergey Grischenko


Add-in Express team


Posts: 6903
Joined: 2004-07-05
Hi Maros.

What exactly changes do you perform at runtime?
Posted 29 Feb, 2008 07:16:25 Top
Maros Kantera




Posts: 17
Joined: 2007-01-09
As I said enabling/disabling controls. Here is the code in ADXAddinAdditionalModule that I'm calling from main module:

public bool ButtonsRequiringDocumentEnabled
{
set
{
dmsMetaDataRibbonButton.Enabled = value;
dmsCompareRibbonButton.Enabled = value;
}
}

But I have also tried to modify Visible property without success.
Posted 29 Feb, 2008 08:20:59 Top
Sergey Grischenko


Add-in Express team


Posts: 6903
Joined: 2004-07-05
Ok, I will check it and will let you know about results soon.
Posted 29 Feb, 2008 12:13:10 Top
Maros Kantera




Posts: 17
Joined: 2007-01-09
Hi, do you have any results yet?
Posted 06 Mar, 2008 08:44:22 Top
Sergey Grischenko


Add-in Express team


Posts: 6903
Joined: 2004-07-05
Hi Maros.

I tested the Enabled property of the Ribbon button component in the ADXAddinAdditionalModule. It worked properly.
Please send me the project that reproduces the issue.
Posted 06 Mar, 2008 14:16:37 Top
Maros Kantera




Posts: 17
Joined: 2007-01-09
I have built a sample project. Where should I send it?
Posted 07 Mar, 2008 05:51:23 Top