Can a Ribbon Menu be changed after it has been shown/created?

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

Can a Ribbon Menu be changed after it has been shown/created?
 
Andrei Jugovic




Posts: 59
Joined: 2007-02-08
Hi!

As described in my earlier post I am working on adding some RibbonControls to an RibbonMenu on runtime.

I have placed a RibbonTab on the Designer, added a RibbonGroup and a RibbonSplitButton.

I use the OnAddInInitialize Methode to call an procedure which adds some buttons and submenus to the SplitButtons's menu. This works fine. When I start Outlook and lunch the NewMailDlg the RibbonTab, the SplitButton with its menu and all submenus and buttons are shown without a problem.

But when I call another procedure (by clicking on a CommandBarButton) to add some more submenus these are not shown any more. Using RibbonMenu.Controls.clear; has no effect either. The RibbonMenu stays as it is.

If the Buttons for adding more Submenues or clearing the Controls are use BEVOR the NewMailDlg is lunched the effects (adding Menus/clearing) are shown.

This leads to the question if a RibbonMenu can be changend after it has been shown? Or is a changing only possible during the startup (OnAddInInitialize)?

Andrei

Posted 26 Apr, 2007 09:10:04 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Andrei,

This leads to the question if a RibbonMenu can be changend after it has been shown? Or is a changing only possible during the startup (OnAddInInitialize)?


Ribbon controls cannot be added/removed after the Ribbon XML was created. So, you can create all Ribbon controls in the TAddinModule.OnRibbonBeforeCreate event handler and later play with their visibility.


P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.


Posted 26 Apr, 2007 10:00:57 Top
Andrei Jugovic




Posts: 59
Joined: 2007-02-08
Ribbon controls cannot be added/removed after the Ribbon XML was created. So, you can create all Ribbon controls in the TAddinModule.OnRibbonBeforeCreate event handler and later play with their visibility.


The planed AddIn will enable the user to apply predefined setting to a new mail. It should be possible to define a number of such settings and then apply them a new mail by selectem them out of a menu.

Creating a large number of RibbonControl to make them visible depending on how many setting have been defined would be very impractical.

Do you have any idea for a better solution?

There has to be a way to add new Control to a RibbonMenu. Have a look at the Signature Button on the 'Insert' RibbonGroup of the MessageTab in the NewMailDgl. When you click on that button a list of all defined signatures is shown. If you create a new signature or delete one this change can be seen in the buttons menu.

This is exactly what I am looking for. Do you have any idea how this is implemented?

PS:
Ribbon controls cannot be added/removed after the Ribbon XML was created. So, you can create all Ribbon controls in the TAddinModule.OnRibbonBeforeCreate event handler and later play with their visibility.


Is this valide for CommandBar Menus as well? I just tried to do the same with a CommandBar Menu instead of a RibbonMenu and got the same result...
Posted 27 Apr, 2007 01:55:11 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Andrei,

This is exactly what I am looking for. Do you have any idea how this is implemented?


We will try to add such a feature in the next Add-in Express build. At the moment you can try to use the TadxRibbonGallery component instead of TadxRibbonMenu and work with the Items collection. This collection is dinamically updated.

Is this valide for CommandBar Menus as well? I just tried to do the same with a CommandBar Menu instead of a RibbonMenu and got the same result...


Everything should work well with commandbars. Could you please show me your code?


Posted 27 Apr, 2007 06:19:35 Top
Andrei Jugovic




Posts: 59
Joined: 2007-02-08
Quote
This is exactly what I am looking for. Do you have any idea how this is implemented?



We will try to add such a feature in the next Add-in Express build. At the moment you can try to use the TadxRibbonGallery component instead of TadxRibbonMenu and work with the Items collection. This collection is dinamically updated.


Any news on that?
Posted 28 May, 2007 08:37:36 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Andrei,

See the Dynamic property and the OnCreate event of the TadxRibbonMenu class.

Posted 28 May, 2007 09:49:28 Top
Andrei Jugovic




Posts: 59
Joined: 2007-02-08
I have updated to the latest version and found the Dynamic property of the Th TadxRibbon Menu. When setting the property to true on a SplitButton Menu I get the Message "The TadxRibbonSplitButton control cannot contain a dynamic menu!". Is there no way to use this function with a SplitButton? As far as I can see the Button for selecting a signature is also a SplitButton...

What do I need the OnCreate event for in that context?
Posted 30 May, 2007 07:20:05 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Andrei,

The TadxRibbonSplitButton control cannot contain a dynamic menu. The button for selecting a signature in Outlook inspector (msoID = "SignatureInsertMenu") has the "menu" type.

The TadxRibbonMenu.OnCeate event will be raised before the dynamic menu drops down.

Posted 30 May, 2007 13:34:17 Top