Tool removal in ultratoolbarsmanager - refresh issue

Posted by Darren Parr on 26-Oct-2012 12:20

Hi

Heres another one regarding the ultratoolbar.

I have a strange problem where items from a popupmenu are all there, are marked as visible but don't display. Its a menu I build dynamically from statebuttontool's which are part of an optionset. Effectively everytime I rebuild it, I remove all of the tools in the menu from the tools collection of the optionset, the tools collection of the menu and then ultimately from the root tools collection, like so..

REPEAT WHILE oMenu:Tools:Count > 0:

   iIndex1 = oToolbar:Tools:IndexOf(oMenu:Tools[0]:Key).

   iIndex2 = oOption:Tools:IndexOf(oMenu:Tools[0]:Key).

       

   oMenu:Tools:RemoveAt(0).

   oOption:Tools:RemoveAt(iIndex2).

   oToolbar:Tools:RemoveAt(iIndex1).

END.

This works great for the 1st time, when the menus tools collection is empty and hence the code never executes.

Every subsequent time, I get no errors and I have even displayed the property page which shows the toolbar object and everything is as it should be at all stages.

Is there something I need to do to get the menu to show?

Thanks

Darren

All Replies

Posted by Admin on 26-Oct-2012 12:23

Ribbon or Toolbar?

Posted by Darren Parr on 26-Oct-2012 12:26

Hi

We're using the ribbon.

-D

Posted by Admin on 26-Oct-2012 12:33

The Ribbon does not like removal of tools per the MS Styleguide (that you had to confirm during the installation of the Controlset).

You can ignore this limitation, if you set the Office2007UICompatibility property to false. But then you mail fail to comply with the license for the Ribbon

Posted by Darren Parr on 26-Oct-2012 12:42

Oooops.

I didn't know that.

Its quite a straightforward use really. The popup I'm trying to populate is dynamic as its a list of data retrieval modes and so it needs to change when the data we're pointing it at changes. These options never exceed 20. Could I try and instead add 20 fixed entries and then mark them as not visible if they are not in use. I could then just tweak this array by changing caption, visiblle, tag etc as needed.

Would that also be in violation of the licence?

Thanks

Darren

Posted by Admin on 26-Oct-2012 12:58

If I'm not mistaking, all you can do is to disable tools. From a users perspective hiding and removing them (temporarily) is the same.

An FAQ is available here: http://www.microsoft.com/en-us/download/details.aspx?id=1571

A phrase from the style guide says:

"Controls MUST NOT appear or disappear on the Ribbon as a result of selection in the document."

Controls are what Infragistics has implemented as Tools. Well, document refers to your application window.

Posted by Darren Parr on 26-Oct-2012 13:07

Hi

Just also been reading it. I'm not sure if I conform. I guess I'm using a ribbon popupmeu which displays a set of options. I have decided to implement statebuttons inside an option set with a checkmark. I could have just as easily used a combo which is a single tool with these options.

I'm not wanting to change what the user sees on the ribbon, but the options underneath.

These options are also all on a contextual tab.

Thanks for your help.

I guess you've explained how it works.

Thanks

Darren

This thread is closed